Tomasz BiaĆecki
... are send to server in the form they are shown to the user
... have content type application/x-www-form-urlencoded / multipart/form-data
... decoupled the model and the view
... allows using any data form
... worries about bidirectional model and view updating
Let's assume we've got the following form...
... and we want to transform it into Angular Form
It's easy ...
... creates the following object in scope
myForm: { //form name
fistName:{}, //input name
lastName:{}, //input name
email:{} //input name
}
... provides validation status
myForm: { //form name
$dirty: false, $pristine: true, //dirty or pristine
$valid: false, $invalid: true, //valid or invalid
fistName: { //input name
$dirty: false, $pristine: true, //dirty or pristine
$valid: false, $invalid: true, //valid or invalid
$error: { //validation for field
required: true, //required validation
minlength: false //minlength validation
}
},
email: {} //input name
}
... provides validation status
myForm: { //ngFormController
$dirty: false, $pristine: true,
$valid: false, $invalid: true,
fistName: { //ngModelController
$dirty: false, $pristine: true,
$valid: false, $invalid: true,
$error: {
required: true,
minlength: false
}
},
email: {} //ngModelController
}