angularjs-input box information of bidirectional data binding is displayed at any time

Source: Internet
Author: User

The following is one of the uses of Angularjs two-way data binding: User input box input information, with user information input, information is displayed in an element at any time

Two-way data binding if you do not need to have any action on the input data, just display the user input information in the page, you do not need to <div ng-app= ' > inside any of the words, only need to xiewei empty characters, a user input information element binding ng-model= ' name ', the display element is bound in the following two ways can be implemented

Mode one: ng-bind= ' name '

<! DOCTYPE html>
<meta charset= "UTF-8" >
<title> two ways of data binding </title>
<script src= "Angular.js" ></script>
<body >
ng-app= "">
ng-model= "name"/>
ng-bind= "name"></div> <!--ng-bind Mode--
</div>
</body>
Mode two: Curly brace form {{name}}
<! DOCTYPE html>
<meta charset= "UTF-8" >
<title> two ways of data binding </title>
<script src= "Angular.js" ></script>
<body >
<div ng-app= "" >
ng-model= "name"/>
<div>{{name}}</div>  <!--curly Braces--
</div>
</body>

The results shown are:

Two-way data binding in this way to achieve a change with the ability to display at any time, do not need to do complicated JS or JS operation

angularjs-input box information of bidirectional data binding is displayed at any time

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.