<div ng-app>
<input type="text" ng-model="txtInput" placeholder="please input sth.">
<p>
<h5>{{txtInput}}</h5>
</p>
</div>
AngularJS 指令是以 ng 作为前缀的 HTML 属性
ng-app:指令定义一个 AngularJS 应用程序
ng-model:将<input>
输入的值绑定到了变量txtInput
angularjs表达式用双括号{{ }}
形式表示,他会对包裹的txtInput
变量进行解析
指令ng-model
一将<input>
输入的值绑定到了变量txtInput
,{{txtInput}}
就解析出来了。
这个过程是同步的,而且是双向的。