AngularJS is simple to implement bidirectional dynamic binding in <input type= "text"/> as follows:
<input type= "text" ng-model= "Topic.title"/>
you only need to use Ng-model to correspond to the attributes in the $scope, that is, the type= "text" is implemented in two-way dynamic binding. the situation is slightly different when <input type= "Radio"/> and <input type= "checkbox"/>:
1. <inputtype= "Radio"/> :
<input type= "Radio" name= "Person-action" value= "Go_home" ng-model= "person.action"/> Home <input type= "Radio" Name= "Person-action" value= "Go_to_school" ng-model= "Person.action"/> Back to School
type= "Radio" is implemented by specifying the value in the selected state with the Value property and Ng-model the radio box to the property in the $scope. Two-way dynamic binding when the
2. <input type= "checkbox"/> :
<input type= "checkbox" Ng-true-value= "true" Ng-false-value= "false" ng-model= "Phone.play_sound"/> Ringtone <input type= "checkbox" Ng-true-value= "true" Ng-false-value= "false" ng-model= "Phone.play_vibrate"/> Vibrate <input type= " CheckBox "Ng-true-value=" true "Ng-false-value=" false "ng-model=" phone.play_lights "/> Breathing Light
through AngularJS 's built-in directives Ng-true-value and ng-false-value , specify the values for the multi box in the selected and unchecked states, and then Ng-model the two-way dynamic binding of the type= "checkbox" is achieved by the corresponding attributes in the $scope.
Finish.
This article is from the "barrel of fake dog excrement" blog, please be sure to keep this source http://xitongjiagoushi.blog.51cto.com/9975742/1665752
Work accumulation (eight) two-way dynamic binding of--angularjs with single box and multi-marquee