From 8657ca42980e0084080612aa17c5b2df2517f3ca Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Tue, 8 Dec 2015 11:17:39 -0800 Subject: [PATCH] fix(form): Form directives are exportedAs 'ngForm' (was 'form') fixes #5658 BREAKING CHANGE: Before:
After: Closes #5709 --- .../src/common/forms/directives/ng_control_group.ts | 6 +++--- .../angular2/src/common/forms/directives/ng_control_name.ts | 6 +++--- modules/angular2/src/common/forms/directives/ng_form.ts | 4 ++-- .../angular2/src/common/forms/directives/ng_form_control.ts | 2 +- .../angular2/src/common/forms/directives/ng_form_model.ts | 2 +- modules/angular2/src/common/forms/directives/ng_model.ts | 2 +- modules/angular2/test/common/forms/integration_spec.ts | 4 ++-- modules/playground/src/model_driven_forms/index.ts | 2 +- modules/playground/src/template_driven_forms/index.ts | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/angular2/src/common/forms/directives/ng_control_group.ts b/modules/angular2/src/common/forms/directives/ng_control_group.ts index f99aa42144..7d33012eca 100644 --- a/modules/angular2/src/common/forms/directives/ng_control_group.ts +++ b/modules/angular2/src/common/forms/directives/ng_control_group.ts @@ -37,8 +37,8 @@ const controlGroupProvider = * template: ` *
*

Angular2 Control & ControlGroup Example

- * - *
+ * + *
*

Enter your name:

*

First:

*

Middle:

@@ -73,7 +73,7 @@ const controlGroupProvider = selector: '[ng-control-group]', providers: [controlGroupProvider], inputs: ['name: ng-control-group'], - exportAs: 'form' + exportAs: 'ngForm' }) export class NgControlGroup extends ControlContainer implements OnInit, OnDestroy { diff --git a/modules/angular2/src/common/forms/directives/ng_control_name.ts b/modules/angular2/src/common/forms/directives/ng_control_name.ts index c43eda0b04..2c05bcb1b7 100644 --- a/modules/angular2/src/common/forms/directives/ng_control_name.ts +++ b/modules/angular2/src/common/forms/directives/ng_control_name.ts @@ -49,8 +49,8 @@ const controlNameBinding = * selector: "login-comp", * directives: [FORM_DIRECTIVES], * template: ` - * - * Login + * + * Login *
Login is invalid
* * Password @@ -93,7 +93,7 @@ const controlNameBinding = bindings: [controlNameBinding], inputs: ['name: ngControl', 'model: ngModel'], outputs: ['update: ngModelChange'], - exportAs: 'form' + exportAs: 'ngForm' }) export class NgControlName extends NgControl implements OnChanges, OnDestroy { diff --git a/modules/angular2/src/common/forms/directives/ng_form.ts b/modules/angular2/src/common/forms/directives/ng_form.ts index eefa78c328..bf9f9e5691 100644 --- a/modules/angular2/src/common/forms/directives/ng_form.ts +++ b/modules/angular2/src/common/forms/directives/ng_form.ts @@ -47,7 +47,7 @@ const formDirectiveProvider = *
*

Submit the form to see the data object Angular builds

*

NgForm demo

- * + * *

Control group: credentials

*
*

Login:

@@ -84,7 +84,7 @@ const formDirectiveProvider = '(submit)': 'onSubmit()', }, outputs: ['ngSubmit'], - exportAs: 'form' + exportAs: 'ngForm' }) export class NgForm extends ControlContainer implements Form { form: ControlGroup; diff --git a/modules/angular2/src/common/forms/directives/ng_form_control.ts b/modules/angular2/src/common/forms/directives/ng_form_control.ts index 4ee46cd156..d24ea4ee5d 100644 --- a/modules/angular2/src/common/forms/directives/ng_form_control.ts +++ b/modules/angular2/src/common/forms/directives/ng_form_control.ts @@ -79,7 +79,7 @@ const formControlBinding = bindings: [formControlBinding], inputs: ['form: ngFormControl', 'model: ngModel'], outputs: ['update: ngModelChange'], - exportAs: 'form' + exportAs: 'ngForm' }) export class NgFormControl extends NgControl implements OnChanges { form: Control; diff --git a/modules/angular2/src/common/forms/directives/ng_form_model.ts b/modules/angular2/src/common/forms/directives/ng_form_model.ts index 5e28486ae4..084ea9449d 100644 --- a/modules/angular2/src/common/forms/directives/ng_form_model.ts +++ b/modules/angular2/src/common/forms/directives/ng_form_model.ts @@ -100,7 +100,7 @@ const formDirectiveProvider = inputs: ['form: ng-form-model'], host: {'(submit)': 'onSubmit()'}, outputs: ['ngSubmit'], - exportAs: 'form' + exportAs: 'ngForm' }) export class NgFormModel extends ControlContainer implements Form, OnChanges { diff --git a/modules/angular2/src/common/forms/directives/ng_model.ts b/modules/angular2/src/common/forms/directives/ng_model.ts index cffcb79087..3e04a8d9a5 100644 --- a/modules/angular2/src/common/forms/directives/ng_model.ts +++ b/modules/angular2/src/common/forms/directives/ng_model.ts @@ -52,7 +52,7 @@ const formControlBinding = bindings: [formControlBinding], inputs: ['model: ngModel'], outputs: ['update: ngModelChange'], - exportAs: 'form' + exportAs: 'ngForm' }) export class NgModel extends NgControl implements OnChanges { /** @internal */ diff --git a/modules/angular2/test/common/forms/integration_spec.ts b/modules/angular2/test/common/forms/integration_spec.ts index a21d2e13ff..edd5937a37 100644 --- a/modules/angular2/test/common/forms/integration_spec.ts +++ b/modules/angular2/test/common/forms/integration_spec.ts @@ -968,7 +968,7 @@ export function main() { // {{x.valid}} used to crash because valid() tried to read a property // from form.control before it was set. This test verifies this bug is // fixed. - var t = `
+ var t = `
{{x.valid}}`; var fixture: ComponentFixture; tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then( @@ -1072,4 +1072,4 @@ function sortedClassList(el) { var l = DOM.classList(el); ListWrapper.sort(l); return l; -} \ No newline at end of file +} diff --git a/modules/playground/src/model_driven_forms/index.ts b/modules/playground/src/model_driven_forms/index.ts index 2fe4f8ab94..ec833d4a36 100644 --- a/modules/playground/src/model_driven_forms/index.ts +++ b/modules/playground/src/model_driven_forms/index.ts @@ -78,7 +78,7 @@ class ShowError { template: `

Checkout Form (Model Driven)

-
+

diff --git a/modules/playground/src/template_driven_forms/index.ts b/modules/playground/src/template_driven_forms/index.ts index 8a61942382..00f777e5af 100644 --- a/modules/playground/src/template_driven_forms/index.ts +++ b/modules/playground/src/template_driven_forms/index.ts @@ -100,7 +100,7 @@ class ShowError { template: `

Checkout Form

- +