数据绑定:
<input type="text" ng-model="name" value=""/>
{{name}}
<input type="text" ng-model="name" value=""/>
数据的双向绑定 页面显示效果:
ng-controller
<div ng-app>
<div ng-controller="firstController">
<input type="text" value="" ng-model="name"/>
<input type="text" value="" ng-model="age"/>
{{name}}{{age}}
</div>
<div/>
js 中声明一个变量叫"firstController";
<script type="text/javascript">
var firstController= function($scope){
var firstController= function($scope){
//声明一个controller Model
//$scope对象 我们称之为作用域
$scope.name = "张三"; //前边的input值会变成"张三"
$scope.age = "20";
}
</script>
</script>