angularjs - Angular looping through items in controller -
i have unique scenario able angular ng-repeat type logic in controller. using slidebar on mobile sized screens, requires div makes navigation sit outside containing div of website.
this logic inside of index.ejs express file:
<body> <div ng-view></div> <div class="sb-slidebar sb-left"></div> </body>
my standard desktop size sidebar typical ng-repeat logic:
<li ng-repeat="items in service"><a href="/service/{{item.shortname}}">{{item.title}}</li></a>
since slidebar logic in core index.ejs express file on server side, don't have access angular view logic. solution @ moment logic in controller based on url:
$scope.$on('$viewcontentloaded', function () { var index = window.location.pathname.split('/')[1]; if(index == 'services'){ $(".sb-left ul").html("<li>service categories<li>"); } }
this approach works; however, i'd inner html updated dynamically, similar template tag instead of being hardcoded now.
Comments
Post a Comment