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
11
modules/angular2/src/forms/directives.js
vendored
11
modules/angular2/src/forms/directives.js
vendored
@ -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
|
* the control will reflect that change. Likewise, if the value of the control changes, the input element reflects that
|
||||||
* change.
|
* 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.
|
* `ControlDirective`, `ControlGroupDirective`. This is just a shorthand for the same end result.
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* @Component({selector: "login-comp"})
|
* @Component({selector: "login-comp"})
|
||||||
* @View({
|
* @View({
|
||||||
* directives: [FormDirectives],
|
* directives: [formDirectives],
|
||||||
* inline: "<input type='text' [control]='loginControl'>"
|
* inline: "<input type='text' [control]='loginControl'>"
|
||||||
* })
|
* })
|
||||||
* class LoginComp {
|
* 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
|
* 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.
|
* 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.
|
* `ControlDirective`, `ControlGroupDirective`. This is just a shorthand for the same end result.
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* @Component({selector: "login-comp"})
|
* @Component({selector: "login-comp"})
|
||||||
* @View({
|
* @View({
|
||||||
* directives: [FormDirectives],
|
* directives: [formDirectives],
|
||||||
* inline: "<form [control-group]='loginForm'>" +
|
* inline: "<form [control-group]='loginForm'>" +
|
||||||
* "Login <input type='text' control='login'>" +
|
* "Login <input type='text' control='login'>" +
|
||||||
* "Password <input type='password' control='password'>" +
|
* "Password <input type='password' control='password'>" +
|
||||||
@ -271,7 +271,6 @@ export class ControlGroupDirective {
|
|||||||
*
|
*
|
||||||
* @exportedAs angular2/forms
|
* @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
|
ControlGroupDirective, ControlDirective, CheckboxControlValueAccessor, DefaultValueAccessor
|
||||||
]);
|
]);
|
||||||
|
18
modules/angular2/src/forms/form_builder.js
vendored
18
modules/angular2/src/forms/form_builder.js
vendored
@ -10,8 +10,8 @@ import * as modelModule from './model';
|
|||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* import {Component, View, bootstrap} from 'angular2/angular2';
|
* import {Component, View, bootstrap} from 'angular2/angular2';
|
||||||
* import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
|
* import {FormBuilder, Validators, formDirectives, ControlGroup} from 'angular2/forms';
|
||||||
*
|
*
|
||||||
* @Component({
|
* @Component({
|
||||||
* selector: 'login-comp',
|
* selector: 'login-comp',
|
||||||
* injectables: [
|
* injectables: [
|
||||||
@ -22,7 +22,7 @@ import * as modelModule from './model';
|
|||||||
* template: `
|
* template: `
|
||||||
* <form [control-group]="loginForm">
|
* <form [control-group]="loginForm">
|
||||||
* Login <input control="login">
|
* Login <input control="login">
|
||||||
*
|
*
|
||||||
* <div control-group="passwordRetry">
|
* <div control-group="passwordRetry">
|
||||||
* Password <input type="password" control="password">
|
* Password <input type="password" control="password">
|
||||||
* Confirm password <input type="password" control="passwordConfirmation">
|
* Confirm password <input type="password" control="passwordConfirmation">
|
||||||
@ -30,16 +30,16 @@ import * as modelModule from './model';
|
|||||||
* </form>
|
* </form>
|
||||||
* `,
|
* `,
|
||||||
* directives: [
|
* directives: [
|
||||||
* FormDirectives
|
* formDirectives
|
||||||
* ]
|
* ]
|
||||||
* })
|
* })
|
||||||
* class LoginComp {
|
* class LoginComp {
|
||||||
* loginForm: ControlGroup;
|
* loginForm: ControlGroup;
|
||||||
*
|
*
|
||||||
* constructor(builder: FormBuilder) {
|
* constructor(builder: FormBuilder) {
|
||||||
* this.loginForm = builder.group({
|
* this.loginForm = builder.group({
|
||||||
* login: ["", Validators.required],
|
* login: ["", Validators.required],
|
||||||
*
|
*
|
||||||
* passwordRetry: builder.group({
|
* passwordRetry: builder.group({
|
||||||
* password: ["", Validators.required],
|
* password: ["", Validators.required],
|
||||||
* passwordConfirmation: ["", Validators.required]
|
* passwordConfirmation: ["", Validators.required]
|
||||||
@ -47,11 +47,11 @@ import * as modelModule from './model';
|
|||||||
* });
|
* });
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* bootstrap(LoginComp)
|
* 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}:
|
* {@link ControlGroup} that defines a `password` and a `passwordConfirmation` {@link Control}:
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {bootstrap, If, For, EventEmitter} from 'angular2/angular2';
|
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,
|
// TODO(radokirov): Once the application is transpiled by TS instead of Traceur,
|
||||||
// add those imports back into 'angular2/angular2';
|
// add those imports back into 'angular2/angular2';
|
||||||
@ -42,7 +42,7 @@ import {View} from 'angular2/src/core/annotations_impl/view';
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
directives: [FormDirectives, If]
|
directives: [formDirectives, If]
|
||||||
})
|
})
|
||||||
class HeaderFields {
|
class HeaderFields {
|
||||||
header:ControlGroup;
|
header:ControlGroup;
|
||||||
@ -101,7 +101,7 @@ class HeaderFields {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
directives: [FormDirectives, If]
|
directives: [formDirectives, If]
|
||||||
})
|
})
|
||||||
class SurveyQuestion {
|
class SurveyQuestion {
|
||||||
question:ControlGroup;
|
question:ControlGroup;
|
||||||
@ -144,7 +144,7 @@ class SurveyQuestion {
|
|||||||
<button (click)="submitForm()">Submit</button>
|
<button (click)="submitForm()">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
directives: [FormDirectives, For, HeaderFields, SurveyQuestion]
|
directives: [formDirectives, For, HeaderFields, SurveyQuestion]
|
||||||
})
|
})
|
||||||
class SurveyBuilder {
|
class SurveyBuilder {
|
||||||
form:ControlGroup;
|
form:ControlGroup;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user