My AngularJS project needs a nested directive for layer and item.
<layer>
<item>
</item>
</layer>
And my JavaScript is like this.
angular.module('app', []);
var app = angular.module('app');
app.directive('layer', [
function () {
return {
replace:true,
transclude:true,
template: "<div></div>",
link:function(){
}
}
}
]);
app.directive('item', [
function () {
return {
require:"^layer",
template: "<div></div>",
link: function(){
console.log("ok")
}
}
}
]);
But the console.log("ok") does not populate in item directive.
replace:truechanges own template with <div> but not inner directive. Does it wrong?