Angular自动双向绑定值
2015-04-24 10:38
393 查看
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <div ng-app="myApp" ng-controller="formCtrler"> <form novalidate> Name:<br> <input type="text" ng-model="user.Name"><br> Email:<br> <input type="text" ng-model="user.Email"> <br> <br> <button ng-click="reset()"> RESET</button> </form> <p> form = {{user }}</p> <p> master = {{master}}</p> </div> </body> <script type="text/javascript" src="http://apps.bdimg.com/libs/angular.js/1.2.15/angular.min.js"></script> <script type="text/javascript"> var app = angular.module("myApp", []); app.controller("formCtrler", function ($scope) { $scope.master = { "firstName": '123', "lastName": '456' }; $scope.reset = function () { $scope.user = angular.copy($scope.master); }; //注册事件之后调用为model赋值 $scope.reset(); }); </script> </html>
相关文章推荐
- 双向数据绑定(angular,vue)
- Angular.js数据绑定时自动转义html标签及内容
- angular.js学习(1)--双向数据绑定
- angular 双向绑定原理
- Angular 1.X中的数据双向绑定
- angular2在双向数据绑定时[(ngModel)]无法使用的问题
- angular双向数据绑定实例代码
- angular双向绑定与单向绑定的写法区别
- Bootstrap + AngularJS 双向数据绑定Form表单测试
- Angular2中自定义组件实现双向绑定
- angular 双向数据绑定 初始化页面hide后,就绑定失效了
- angular双向绑定模拟探索
- 【Angular】双向数据绑定--作用域树
- Angular和Vue双向数据绑定的实现原理(重点是vue的双向绑定)
- angular数据双向绑定原理
- 自定义Angular指令与jQuery实现的Bootstrap风格数据双向绑定的单选与多选下拉框
- Angular.js基本概念和用法--(一双向数据绑定)
- Silverlight:双向绑定综合应用-自动更新集合汇总字段
- angular学习总结九——父组件与子组件数据的双向绑定
- angular利用双向数据绑定改变样式