FormBuilder class
Creates a form object from a user-specified configuration.
@Component(
selector: 'my-app',
viewProviders: const [FORM_BINDINGS]
template: '''
<form [ngFormModel]="loginForm">
<p>Login <input ngControl="login"></p>
<div ngControlGroup="passwordRetry">
<p>Password <input type="password" ngControl="password"></p>
<p>Confirm password <input type="password"
ngControl="passwordConfirmation"></p>
</div>
</form>
<h3>Form value:</h3>
<pre>{{value}}</pre>
''',
directives: const [formDirectives]
)
class App {
ControlGroup loginForm;
App() {
final builder = new FormBuilder();
loginForm = builder.group({
"login": ["", Validators.required],
"passwordRetry": builder.group({
"password": ["", Validators.required],
"passwordConfirmation": ["", Validators.required]
})
});
}
String get value {
return JSON.encode(loginForm.value);
}
}
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
controlArray(
List controlsConfig, [ValidatorFn? validator]) → ControlArray -
Construct an array of Controls from the given
controlsConfig
array of configuration, with the given optionalvalidator
. -
controlGroup(
Map< String, dynamic> controlsConfig, {ValidatorFn? validator}) → ControlGroup -
Construct a new ControlGroup with the given map of configuration.
Valid keys for the
extra
parameter map areoptionals
andvalidator
.