简体   繁体   中英

Item collection from server method

Using the WakandaManager service in Quickstart gets a collection of items named 'tasks' that are listed on the client using the angular directive: <li ng-repeat="task in tasks"> .

I have replaced the given code (below);

ds.Item.$all().$promise.then(function(event) {  
    $scope.tasks = event.result;  



ds.Item.getAll_items().$promise.then(function(event) {
    $scope.tasks = event.result;
    $scope.items = $wakanda.$transform.$objectToCollection(event.result);
});

The client html {{tasks.length}} gets the correct value, however; neither <li ng-repeat="task in tasks"> or <li ng-repeat="item in items"> displays the listed entities.

What is the correct syntax to display the entity collection returned by the server method?

You directly use $wakanda variable but it's not defined at any place.

$wakanda is available through WakandaManager .

So, your call to $transform method should look like this:

ds.Item.getAll_items().$promise.then(function(event) {
    $scope.tasks = event.result;
    $scope.items = WakandaManager.$wakanda.$transform.$objectToCollection(event.result);
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM