JS
.directive("navigation", function(RecursionHelper){
return{
//restrict = "E",
scope:{
menu : '='
},
template :
'<ul class="" role="menu" ng-repeat="value in menu" ng-class="{\'nav navbar-nav\': value.firstlvl==\'true\' , \'dropdown-menu\': value.firstlvl==\'false\'} ">'+
'<li class="" ng-class="{\'dropdown-submenu\': value != undefined} " >'+
'<a href="#" data-toggle="dropdown" tabindex="0" aria-expanded="false">'+
' {{value.vcCategoryDescription}}'+
'<navigation menu="value.SUB"></navigation>'+
'</a>'+
// '<ul class="sub dropdown-menu" role="menu" >'+
// '<li class="dropdown-submenu" ng-repeat="value in menu>'+
// '<a data-toggle="dropdown" tabindex="0" >{{value.SUB}}</a>'+
// '</li>'
// '</ul>'
'</li>'+
'</ul>',
compile: function(element) {
return RecursionHelper.compile(element, function(scope, iElement, iAttrs, controller, transcludeFn){
// Define your normal link function here.
// Alternative: instead of passing a function,
// you can also pass an object with
// a 'pre'- and 'post'-link function.
});
}
}
});
HTML
<div class="col-lg-8 col-md-9 col-sm-12 bs-menu">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<navigation menu="category"></navigation>
</div>
目前我想删除此部分<navigation menu="category"></navigation>
。因为下拉子菜单的<navigation>
无法正常工作。循环时,<ul><navigation><li></li></navigation></ul>
,这将影响我的下拉子菜单可以探测功能。任何人都可以有想法或解决方案吗?
答案 0 :(得分:0)
在指令定义对象集中,替换为:true