Outside myDirective:{{myProperty}}
Inside myDirective:{{myProperty}}
这是html的文件
下边是js的
1 scope=true
.directive('myDirective',function () {
return {
restrict:'A',
//scope:{},
scope:true,
priority:100,
template:'Inside myDirective {{myProperty}}
'
};
});
ff下显示
Outside myDirective:
Inside myDirective wow,this is coll
2 scope {}
.directive('myDirective',function () {
return {
restrict:'A',
scope:{},
priority:100,
template:'Inside myDirective {{myProperty}}
'
};
});
ff 下显示
Outside myDirective:wow,this is coll
Inside myDirective
scope:true; 将会创建一个新的作用域出来,所以本级可以读到myPropery上一级读取不到
scope:{},为甚么上一级可以读到!本级读取不到呢?
这个实在能晕了!不懂啊!请各位指点!谢谢
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
闭关修行中......