Note that there are some explanatory texts on larger screens.

plurals
  1. POAngularJS not binding promise to template
    text
    copied!<p><strong>My service:</strong></p> <hr> <p><strong>This was mistake 1 of 2 cause of my error:</strong></p> <pre><code> getAll: function(url) { deferred.resolve($http({ &lt;--- deferred.resolve should not have been here method: 'GET', url: url, contentType: "application/json; charset=utf-8", cache: true, headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })); return deferred.promise; }, </code></pre> <p><strong>Should have been instead:</strong></p> <pre><code> getAll: function (url) { $http({ method: 'GET', url: url, contentType: "application/json; charset=utf-8", cache: true, headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).success(function (data) { deferred.resolve(data); }); return deferred.promise; </code></pre> <hr> <p><strong>My controller:</strong></p> <p><strong>This was mistake 2 of 2 cause of my error:</strong></p> <pre><code> // $scope.PassengerVehicles = crudSvc.getAll('/_json/PassengerVehicles.js'); // should have been: crudSvc.getAll('/_json/PassengerVehicles.js').then(function (data) { $scope.PassengerVehicles = data; }); </code></pre> <p><strong>My template:</strong></p> <pre><code> &lt;ul data-ng-repeat="passVeh in PassengerVehicles"&gt; &lt;li&gt;{{passVeh.itemId}}&lt;/li&gt; &lt;/ul&gt; </code></pre> <p><strong>Here is my plunker, which has been corrected:</strong></p> <p><a href="http://plnkr.co/edit/QJlkMjh0MkXSRJGk7oJV?p=preview" rel="nofollow">AngularJS not binding promise to template</a></p> <p><strong>Than You Fourth!!</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload