javascript - binding string array to navigation bar -
updated code: have string array in controller below,
var app = angular.module('myapp', []); app.controller('mycontroller', function($scope) { $scope.menuitems =['home','about']; }; }); i need display in navigation pane (navigation should on leftside) below html code.
<body class="container-fluid"> <div class="col-md-2"> <ul class="nav nav-pills nav-stacked" ng-repeat="x in menuitems track $index"> <li>{{x}}</li> </ul> </div> </body> i did string values bound navigation pane. showing text {{x}}.
kindly help
- in javascript code
};unnecessary. - you haven't attached
controllerdiv.
code.
javascript:
var app = angular.module('myapp', []); app.controller('mycontroller', function($scope) { $scope.menuitems = ['home', 'about']; //}; // remove }); html:
<div class="col-md-2" ng-controller="mycontroller"> <!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --> <ul class="nav nav-pills nav-stacked" ng-repeat="x in menuitems track $index"> <li>{{x}}</li> </ul>
Comments
Post a Comment