Work accumulation (eight) two-way dynamic binding of--angularjs with single box and multi-marquee

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.