那个 require:"^..",为什么总是报错找不到指令啊?
directives.directive('num',function(){
return{
scope:{},
retrict:'EA',
conteoller:function($scope){
$scope.att=[];
this.addOne=function(){
$scope.att.push('1');
};
this.addTwo=function(){
$scope.att.push('2');
};
this.addThree=function(){
$scope.att.push('3');
};
},
link:function(scope,ele,attrs){
ele.on('mouseenter',function(event){
console.log(scope.att)
});
ele.addClass('btn btn-primary');
}
}
})
directives.directive('one',function(){
return{
retrict:'EA',
require:'?^num',
link:function(scope,ele,attrs,numCtrl){
numCtrl.addOne();
}
}
})
directives.directive('two',function(){
return{
retrict:'EA',
require:'^num',
link:function(scope,ele,attrs,numCtrl){
numCtrl.addTwo();
}
}
})
directives.directive('three',function(){
return{
retrict:'EA',
require:'^num',
link:function(scope,ele,attrs,numCtrl){
numCtrl.addThree();
}
}
})