0

I just want to ask why the submenu of this menu bar are not showing when i used the 1.2.1 angular.js. but in 1.1.1 is show perfectly.

this is the fiddle of the menu bar: here http://jsfiddle.net/kmussel/evXFZ/? 'use strict';

 var app = angular.module('App', []);


 app.controller('NavCtrl', ['$scope', '$location', function ($scope, $location) {
   $scope.breadcrumbs = [];
   $scope.menu =   [
         {text: 'HOME', href:'/app/index.html', children: [
             {text:'MANAGE Dashboard', href:'/dashb'}
           ]
           },
         {text: 'MANAGE', href:'/manage', children: [
           {text:'MANAGE PEOPLE', href:'/manage-people', children: [
               {text:'MANAGE STAFF', href:'/manage-staff'},
               {text:'MANAGE CLIENTS', href:'/manage-clients'}              
             ]}
         ]},
              {text: 'REPORTS', href:'/reports', children: [
                {text: 'REPORT NUMERO UNO', href: '#'},
           {text: 'REP NUMERO 2', href: '#', children: [{text:'Third Tier', href: '#'},                     {text:'Another Third Tier', href: '#', children: [
               {text:'SUB SUB NAV', href:'#'}
             ]}]}
         ]},
         {text: 'MY INFO', href:'/my-info' },
       ]


 }]);


 /* Directives */


 app.directive('navMenu', ['$parse', '$compile', function($parse, $compile) {
     return {
         restrict: 'C', //Element
         scope:true,
         link: function (scope, element, attrs)
         {
             scope.selectedNode = null;

             scope.$watch( attrs.menuData, function(val)
             {

            var template = angular.element('<ul id="parentTreeNavigation"><li ng-          repeat="node in ' + attrs.menuData + '" ng-class="{active:node.active && node.active==true,      \'has-dropdown\': !!node.children && node.children.length}"><a ng-href="{{node.href}}" ng-     click="{{node.click}}" target="{{node.target}}" >{{node.text}}</a><sub-navigation-tree>     </sub-navigation-tree></li></ul>');

                 var linkFunction = $compile(template);
                 linkFunction(scope);
                 element.html(null).append( template );

             }, true );
         }
     };
 }])
 .directive('subNavigationTree', ['$compile', function($compile)
 {
     return {
         restrict: 'E', //Element
         scope:true,
         link: function (scope, element, attrs)
    {
        scope.tree = scope.node;

             if(scope.tree.children && scope.tree.children.length )
             {
            var template = angular.element('<ul class="dropdown "><li ng-repeat="node in      tree.children" node-id={{node.' + attrs.nodeId + '}}  ng-class="{active:node.active &&      node.active==true, \'has-dropdown\': !!node.children && node.children.length}"><a ng-href="     {{node.href}}" ng-click="{{node.click}}" target="{{node.target}}" ng-bind-html-     unsafe="node.text"></a><sub-navigation-tree tree="node"></sub-navigation-tree></li></ul>');

            var linkFunction = $compile(template);
            linkFunction(scope);
            element.replaceWith( template );
        }
        else
        {
            element.remove();
        }
         }
      };
 }]);

Thank You in advance. =)

user3274033
  • 29
  • 2
  • 11
  • Hello?? is there someone can help me? – user3274033 Feb 24 '14 at 02:02
  • 1
    Try to make a plnkr.co out of it there you can add multiple files and play with ngSanitize... I think you need to get rid of ng-bind-html-unsafe (use ng-bind-html) and include angular-sanitize.js and the ngSanitize module – shaunhusain Feb 24 '14 at 02:11
  • 1
    You either need to use the $sce service to 'trust' the html string or write a replacement for ng-bind-html-unsafe. See this answer: http://stackoverflow.com/questions/18926306/angularjs-ng-bind-html-unsafe-replacement – link64 Feb 24 '14 at 03:21

0 Answers0