Rectangle 27 0

javascript angular js model doesn't bind?


angular.module('3pix').controller('ListController', ['$scope', 'jquery', 'list',
    function ($scope, $, list) {
        $scope.list = list.loadItems()
}]);
ng-repeat="item in list"

Also can you try this in html

I am not talking about adding any property on controller but the sevice you have injected does not have a property items which you are trying to bind in the view

I prefer not to add a property on the controller because I already have this property in the List service. More then that, List has other methods that add items. Is there any other way to do it?

I think the problem is that you are assigning the scope list to the service instance instead of the method result.

The service does have the property items: List.items holds the items.

You can still use the list service variable. The list service you have defined does not contain any items property that you are binding to. So you either bind the promise or you bind the return value retrieved using then method on promise.

list also contains other properties that I need in my views. In my question I reduced the class to what necessary.

Note