refactor(forms): rename FormDirectives to formDirectives
BREAKING CHANGE: A collection of all the form directives is exported under `formDirectives` while those were previously available under `FormDirectives`. Closes #1804
This commit is contained in:
parent
5036086fb3
commit
229e770a1d
|
@ -97,13 +97,13 @@ export class CheckboxControlValueAccessor {
|
|||
* the control will reflect that change. Likewise, if the value of the control changes, the input element reflects that
|
||||
* change.
|
||||
*
|
||||
* Here we use {@link FormDirectives}, rather than importing each form directive individually, e.g.
|
||||
* Here we use {@link formDirectives}, rather than importing each form directive individually, e.g.
|
||||
* `ControlDirective`, `ControlGroupDirective`. This is just a shorthand for the same end result.
|
||||
*
|
||||
* ```
|
||||
* @Component({selector: "login-comp"})
|
||||
* @View({
|
||||
* directives: [FormDirectives],
|
||||
* directives: [formDirectives],
|
||||
* inline: "<input type='text' [control]='loginControl'>"
|
||||
* })
|
||||
* class LoginComp {
|
||||
|
@ -183,13 +183,13 @@ export class ControlDirective {
|
|||
* In this example, we bind the control group to the form element, and we bind the login and password controls to the
|
||||
* login and password elements.
|
||||
*
|
||||
* Here we use {@link FormDirectives}, rather than importing each form directive individually, e.g.
|
||||
* Here we use {@link formDirectives}, rather than importing each form directive individually, e.g.
|
||||
* `ControlDirective`, `ControlGroupDirective`. This is just a shorthand for the same end result.
|
||||
*
|
||||
* ```
|
||||
* @Component({selector: "login-comp"})
|
||||
* @View({
|
||||
* directives: [FormDirectives],
|
||||
* directives: [formDirectives],
|
||||
* inline: "<form [control-group]='loginForm'>" +
|
||||
* "Login <input type='text' control='login'>" +
|
||||
* "Password <input type='password' control='password'>" +
|
||||
|
@ -271,7 +271,6 @@ export class ControlGroupDirective {
|
|||
*
|
||||
* @exportedAs angular2/forms
|
||||
*/
|
||||
// todo(misko): rename to lover case as it is not a Type but a var.
|
||||
export const FormDirectives:List = CONST_EXPR([
|
||||
export const formDirectives:List = CONST_EXPR([
|
||||
ControlGroupDirective, ControlDirective, CheckboxControlValueAccessor, DefaultValueAccessor
|
||||
]);
|
||||
|
|
|
@ -10,8 +10,8 @@ import * as modelModule from './model';
|
|||
*
|
||||
* ```
|
||||
* import {Component, View, bootstrap} from 'angular2/angular2';
|
||||
* import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
|
||||
*
|
||||
* import {FormBuilder, Validators, formDirectives, ControlGroup} from 'angular2/forms';
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'login-comp',
|
||||
* injectables: [
|
||||
|
@ -22,7 +22,7 @@ import * as modelModule from './model';
|
|||
* template: `
|
||||
* <form [control-group]="loginForm">
|
||||
* Login <input control="login">
|
||||
*
|
||||
*
|
||||
* <div control-group="passwordRetry">
|
||||
* Password <input type="password" control="password">
|
||||
* Confirm password <input type="password" control="passwordConfirmation">
|
||||
|
@ -30,16 +30,16 @@ import * as modelModule from './model';
|
|||
* </form>
|
||||
* `,
|
||||
* directives: [
|
||||
* FormDirectives
|
||||
* formDirectives
|
||||
* ]
|
||||
* })
|
||||
* class LoginComp {
|
||||
* loginForm: ControlGroup;
|
||||
*
|
||||
*
|
||||
* constructor(builder: FormBuilder) {
|
||||
* this.loginForm = builder.group({
|
||||
* login: ["", Validators.required],
|
||||
*
|
||||
*
|
||||
* passwordRetry: builder.group({
|
||||
* password: ["", Validators.required],
|
||||
* passwordConfirmation: ["", Validators.required]
|
||||
|
@ -47,11 +47,11 @@ import * as modelModule from './model';
|
|||
* });
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*
|
||||
* bootstrap(LoginComp)
|
||||
* ```
|
||||
*
|
||||
* This example creates a {@link ControlGroup} that consists of a `login` {@link Control}, and a nested
|
||||
*
|
||||
* This example creates a {@link ControlGroup} that consists of a `login` {@link Control}, and a nested
|
||||
* {@link ControlGroup} that defines a `password` and a `passwordConfirmation` {@link Control}:
|
||||
*
|
||||
* ```
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {bootstrap, If, For, EventEmitter} from 'angular2/angular2';
|
||||
import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
|
||||
import {FormBuilder, Validators, formDirectives, ControlGroup} from 'angular2/forms';
|
||||
|
||||
// TODO(radokirov): Once the application is transpiled by TS instead of Traceur,
|
||||
// add those imports back into 'angular2/angular2';
|
||||
|
@ -42,7 +42,7 @@ import {View} from 'angular2/src/core/annotations_impl/view';
|
|||
</div>
|
||||
</div>
|
||||
`,
|
||||
directives: [FormDirectives, If]
|
||||
directives: [formDirectives, If]
|
||||
})
|
||||
class HeaderFields {
|
||||
header:ControlGroup;
|
||||
|
@ -101,7 +101,7 @@ class HeaderFields {
|
|||
</div>
|
||||
</div>
|
||||
`,
|
||||
directives: [FormDirectives, If]
|
||||
directives: [formDirectives, If]
|
||||
})
|
||||
class SurveyQuestion {
|
||||
question:ControlGroup;
|
||||
|
@ -144,7 +144,7 @@ class SurveyQuestion {
|
|||
<button (click)="submitForm()">Submit</button>
|
||||
</div>
|
||||
`,
|
||||
directives: [FormDirectives, For, HeaderFields, SurveyQuestion]
|
||||
directives: [formDirectives, For, HeaderFields, SurveyQuestion]
|
||||
})
|
||||
class SurveyBuilder {
|
||||
form:ControlGroup;
|
||||
|
|
Loading…
Reference in New Issue