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:
Pawel Kozlowski 2015-05-11 15:20:04 +02:00
parent 5036086fb3
commit 229e770a1d
3 changed files with 18 additions and 19 deletions

View File

@ -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
]); ]);

View File

@ -10,7 +10,7 @@ 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',
@ -30,7 +30,7 @@ import * as modelModule from './model';
* </form> * </form>
* `, * `,
* directives: [ * directives: [
* FormDirectives * formDirectives
* ] * ]
* }) * })
* class LoginComp { * class LoginComp {

View File

@ -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;