javascript - ng-switch inside ng-repeat Angularjs -


i have question how use ng-switch inside ng-repeat , use scope switch-on ?

example :

 <div ng-repeat="item in submenu">             <div class="animate-switch"  ng-switch-when="{{item.filter}}">                 <div class="navbar navbar-default navbar-static-top {{item.filter}}">                     <div  class="navbar-collapse collapse" id="navbar-{{item.filter}}">                         <ul class="nav navbar-nav subnav">                             <li ng-repeat="subitem in item.sub" class="items"  >                                 <a ng-href="{{subitem.link}}" class="{{selected }}" ng-click="selectfiltersub(subitem.filter)">{{item.name}}</a>                             </li>                         </ul>                     </div>                  </div>             </div>         </div> 

$scope.submenu :

 $scope.submenu =[{             name:'glasba',             filter:'music',             sub:[{                 name:'koncerti',                 filter:'concerts'             },{                 name:'klasika',                 filter:'clasic'             },{                 name:'elektronika',                 filter:'elektro'             },{                 name:'indy',                 filter:'indy'             },{                 name:'teater',                 filter:'theater'             }]         }] 

so problem on ng-switch-when = "{{item.filter}}" <-- not recognize. output same code ng-swith-when="{{item.filter}}" insted of music. can ? thx anwsers !

exmaple picture enter image description here <--upper menu , udner 50px height submenu no content ...

from ng-switch documentation:

be aware attribute values match against cannot expressions. interpreted literal string values match against. example, ng-switch-when="someval" match against string "someval" not against value of expression $scope.someval.

look using ng-if instead:

<div class="animate-switch"  ng-if="item.filter === 'music'">   filter equals 'music' </div> 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -