angularjs - Handling URLs with ui-router's ui-sref -
i have file called menu.json
such:
[ { "label": "search" "icon": "icon-search", "state": "search" }, { "label": "help", "icon": "icon-question-sign", "state": "http://help.abc.com" } ]
this file processed , returned server. utilize render navbar through ngrepeat directive.
<li ng-repeat="entry in menu_entries"> <!-- 'entry' each json object in above array --> <a ui-sref="{{entry.state}}"><i class="{{entry.icon}} icon-white"></i> {{entry.label}}</a> </li>
the states work great, , compiled proper html links, do states urls? must write kind of ui-router urlrouterprovider rule or otherwise function? how guys handle when there's mix of states & urls?
in these cases have bit different json file construction - have attribute called internal: true/fase
each menu item , have simple if statement render link in different attribute.
angularjs angular-ui-router
No comments:
Post a Comment