Skip to content Skip to sidebar Skip to footer

AngularJS Ng-repeat Is Not Working As Expected

I'm having a weird issue, I can access all the elements coming from my scope as data model, also I can see the scope elements in the Chrome console, but when I try using the model

Solution 1:

I removed the 'vm.' in your html and everything works as expected

<body ng-controller="mainController">
   <div ng-controller="app.views.layout.header as vm">

    <p>{{currentMenuName}} {{menu.items[0].displayName}} {{menu.items[1].displayName}}</p>

    <ul>
        <li ng-repeat="menuItem in menu.items">
            <span>Not working! </span>{{menuItem.displayName}}
        </li>
    </ul>

</div>

http://plnkr.co/edit/1BtC8p1ViqKXSbCWE3Kj?p=preview

Or you can us 'this' in your controller instead of $scope (see http://plnkr.co/edit/1BtC8p1ViqKXSbCWE3Kj?p=preview


Post a Comment for "AngularJS Ng-repeat Is Not Working As Expected"