angular.bind() 函数
angular.bind
bind 函数有三个参数,
参一:是一个对象
参二:是一个 function
参三:是用来给参二传参数的,可写可不写,看你心情
参数也可以在调用函数的时候传,也可以当做第三个参数传
在函数的体内可以访问参数一的所有属性值
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src = 'angular-1.2.19.js'></script>
<script>
var self = {
name:'chen'
}
// 一种写法
var f = angular.bind(self,function(age){
alert(this.name+' is '+age+' !'); // chen is 18
},18);
f();
// 另一种写法
var m = angular.bind(self,function(age){
alert(this.name+' is '+age+' !'); // chen is 33
});
m(33);
</script>
</head>
<body>
</body>
</html>
angular.bind() 函数的更多相关文章
- AngularJs angular.bind、angular.bootstrap、angular.copy
angular.bind 返回一个调用self的函数fn(self代表fn里的this).可以给fn提供参数args(*).这个功能也被称为局部操作,以区别功能. 格式:angular.bind(se ...
- Angular - - angular.bind、angular.bootstrap、angular.copy
angular.bind 返回一个调用self的函数fn(self代表fn里的this).可以给fn提供参数args(*).这个功能也被称为局部操作,以区别功能. 格式:angular.bind(se ...
- AngularJS方法 —— angular.bind
描述: 上下文,函数以及参数动态绑定,返回值为绑定之后的函数. 其中args是可选的动态参数,self在fn中使用this调用. 使用方法: angular.bind(self,fn,args ); ...
- (十一)socket、connect、bind函数详解
一.socket函数 1.头文件: #include <sys/types.h> /* See NOTES */ #include <sys/socket.h> 2.函数原型: ...
- Javascript中call、apply、bind函数
javascript在函数创建的时候除了自己定义的参数外还会自动新增this和arguments两个参数 javascript中函数也是对象,call.apply.bind函数就是函数中的三个函数,这 ...
- jQuery.bind() 函数详解
bind()函数用于为每个匹配元素的一个或多个事件绑定事件处理函数. 此外,你还可以额外传递给事件处理函数一些所需的数据. 执行bind()时,事件处理函数会绑定到每个匹配元素上.因此你使用bind( ...
- call,apply,bind函数
一.call函数 a.call(b); 简单的理解:把a对象的方法应用到b对象上(a里如果有this,会指向b) call()的用法:用在函数上面 var Dog=function(){ this.n ...
- C++ Primer : 第十章 : 泛型算法 之 lambda表达式和bind函数
一.lambda表达式 lambda表达式原型: [capture list] (parameter list) -> retrue type { function body } 一个lambd ...
- 模拟实现兼容低版本IE浏览器的原生bind()函数功能
模拟实现兼容低版本IE浏览器的原生bind()函数功能: 代码如下: if(!Function.prototype.bind){ Function.prototype.bind=function( ...
随机推荐
- php 与 js 正则匹配
php : <?php $str='<p>xxx</p>abc';$matches = array();if(preg_match('/<p>.*<\/ ...
- September 17th 2016 Week 38th Saturday
Our eyes do not show a lack of beauty, but a lack of observation. 世上不是缺少美,而是缺少发现美的眼睛. Don't pay too ...
- Android xml text 预览属性
只在 AS 中生效 xmlns:tools="http://schemas.android.com/tools" tools:text="I am a title&quo ...
- UVA 10252
按照字典序输出最长公共子序列 #include<time.h> #include <cstdio> #include <iostream> #include< ...
- ARPPING
http://www.tuicool.com/articles/M7B3umj http://lixcto.blog.51cto.com/4834175/1571838/
- ReentrantLock和synchronized两种锁定机制
ReentrantLock和synchronized两种锁定机制 >>应用synchronized同步锁 把代码块声明为 synchronized,使得该代码具有 原子性(atomicit ...
- DedeCMS Error: (PHP 5.3 and above) Please set request_order
部分使用PHP 5.3的主机可能会有下面的提示: (PHP 5.3 and above) Please set 'request_order' ini value to include C,G and ...
- 【JAVA集合框架之List与Set】
一.概述 JAVA的集合框架中定义了一系列的类,这些类都是存储数据的容器.与数组.StringBuffer(StringBuilder)相比,它的特点是: 1.用于存储对象. 2.集合长度可变. 3. ...
- java读写Properties文件
Java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ...
- sdut 2603:Rescue The Princess(第四届山东省省赛原题,计算几何,向量旋转 + 向量交点)
Rescue The Princess Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 Several days ago, a b ...