scope:{test:"&",param:"=",value:"@"},
link:function(s,el,attr){
el.bind("click",function(){
s.test(); s.param = '哈哈' })}
其中&是用来绑定外部函数的。scope就能调用外部test绑定的函数,即下外部contorller的controllerFunc函数。
2.html
<direct param = "param1" test = "controllerFunc('你好啊',param1)">
<direct param = "param2" test = "controllerFunc('你好啊',param2)">
param1,param2可以是变量,但是传入到js中被赋值给param了。所以这样每个指令的变量可以被隔离开,不影响
3.创建boolean ,可以用!param ,这个表达式的值为 true