1
Ebeveyn yönergesinin denetleyicisine erişen bir üst yönerge tarafından aktarılan bir alt yönergeye sahip olmak istiyorum. Ancak "testChild" yönergesi için gerekli olan "Controller 'testParent" hatası bulunamıyor;transclusion ve üst denetleyiciye erişme
app.directive('testParent', function(){
return {
restrict :'E',
template: '<div>',
transclude:true,
controller: function(){
this.log = function() {
console.log('test');
}
},
link : function(scope, element, attrs, unusedController, transcludeFn) {
element.append(transcludeFn());
}
}
});
app.directive('testChild', function(){
return {
restrict : 'E',
template: '<div>Child</div>',
require:'^testParent',
link : function(scope, element, attrs, controller){
controller.log();
}
}
})
http://plnkr.co/edit/miqH0r80G8bI0B5bAOzA?p=info
teşekkürler! Bana nasıl çalıştığını da söyleyebilir misin? – raichu