4,500
edits
add Forms > Control |
|||
Line 1: | Line 1: | ||
== Forms == | == Forms == | ||
=== @Component Annotation === | |||
<syntaxhighlight lang="typescript"> | |||
import {Component} from 'angular2/core'; | |||
import {FORM_DIRECTIVES} from 'angular2/common'; | |||
@Component({ | |||
selector: 'demo-form-sku', | |||
directives: [FORM_DIRECTIVES] // a shorthand to several directives for forms | |||
}) | |||
</syntaxhighlight> | |||
=== ControlGroup === | |||
<syntaxhighlight lang="typescript"> | |||
let personInfo = new ControlGroup({ | |||
firstName: new Control("Michael"), | |||
lastName: new Control("Han"), | |||
zip: new Control("90210") | |||
}) | |||
// personInfo.value; .errors .dirty .valid | |||
</syntaxhighlight> | |||
=== Control === | === Control === |