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

  1. in javascript code }; unnecessary.
  2. you haven't attached controller div.

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

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -