javascript - Ng-repeat isn't reading from the scope? -
i work angular & ng-repeat @ work, why perplexed why won't render. it's silly i'm overlooking, i've spent enough time on it merits asking else hint.
the relevant bits:
js
.controller('listctrl', function($scope, dataapi){ dataapi.getindex().then(function(res) { console.log('server response', res); $scope.notes = res; });
jade
h1 hello list div(ng-controller='listctrl') div(ng-repeat='note in notes') div {{ note.dist_path }}
the console log of data loaded (array of objects)
server response [object, object, object, object]
no errors in console. inspect scope, , see expect. object of arrays.
the problem dataapi
method getindex
using external library (q) resolve request, rather leaving angular's $http
, $q
. needed call $scope.$apply()
after setting scope variable alert angular of change. or use angular's built in $q
or work promise returned $http
.