Angular.bind方法
来源:互联网 发布:哥特式lolita淘宝 编辑:程序博客网 时间:2024/06/05 19:15
描述: 上下文,函数以及参数动态绑定,返回值为绑定之后的函数. 其中args是可选的动态参数,self在fn中使用this调用。
使用方法:
angular.bind(self,fn,args );
参数:
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>bind例子</title> <script src="../angular-1.3.0.14/angular.js"></script> <script type="text/javascript"> var self = { name: 'boyi' }; //示例1--带参数 var f = angular.bind(self, //绑定对象,作为函数的上下文 //被绑定的函数 function (age) { alert(this.name + ' is ' + age + ' !'); }, //绑定的参数,可省略 '15' ); f();//调用绑定之后的function 弹出 boyi is 15 //示例2--不带参数 var m = angular.bind(self, //绑定对象,作为函数的上下文 //被绑定的函数 function (age) { alert(this.name + ' is ' + age + ' !'); } //省略参数 ); m(3);//调用传参的函数 弹出 boyi is 3 </script></head><body></body></html>
阅读全文
0 0
- Angular.bind方法
- Angular.bind方法
- angular.bind
- bind方法
- Angular 方法
- angular中刷新显示与ng-bind
- Angular指令之ng-bind-html
- boost bind 实现方法
- jQuery 事件 - bind() 方法
- Socket中的Bind方法
- boost bind 实现方法
- boost::bind 方法浅析
- boost bind 实现方法
- boost bind 实现方法
- Bind SQLi方法探究
- JS中的bind方法
- jQuery之 .bind() 方法
- jquery事件bind方法
- android获取屏幕的高度和宽度
- ssm+redis整合的一个Demo
- CIO如何衡量数字化转型成功?
- c++中char *与char[]区别
- 改变radio的样式 以及radio组相关操作的jquery插件
- Angular.bind方法
- 设计模式之禅PK之结构类1
- PHP XDEBUG 远程调试获取不到SERVER_NAME
- 在windows上pycharm配置spark环境
- Java web项目01 停车管理系统实现删除用户信息(六)
- 应用中双击返回键退出程序
- 单链表/双链表问题
- Python属性函数property
- android activity管理类