breeze - AngularJS dataservice using breezejs it not resolving the promise -


i'm trying setup data service in angular application using breezejs. after resolve promise can't .then file in controller. getting data database via breeze in data service. pass breeze promise want able use $q.all know when data has been found.

in controller`

proapp.controller('caseinfocontroller', function caseinfocontroller($scope, $log, $timeout, casedataservice) {

    /***initialize data ***/    // initializeapp();       atpinitializeapp();       function atpinitializeapp() {          $scope.mystatelist=   casedataservice.getallstates()          .then(function assignstates(data) {              $log.info("this not fire");                         });      } 

`

the above not fire when promise data service fulfilled.

proapp.factory('casedataservice', function ($log, $q) {  breeze.config.initializeadapterinstance("modellibrary", "backingstore", true);   var servicename = "http://localhost:60882/breeze/splbreeze"; var manager = new breeze.entitymanager(servicename);  var casedataservice = {    getallstates: getallstates,  };  return casedataservice;  /*** implementation details ***/   function getallstates() {    var mystatepromise = $q.defer();    var query = breeze.entityquery       .from("state");    manager.executequery(query)     .then(function (data) {         $timeout(function () { mystatepromise.resolve(data); }, 200);;     });    return mystatepromise.promise; }; 

any appreciated. i'm not 100% sure if have $q promises set correctly. use $q.all determine when array of various promises have been resolved can update message user. i've been reading need use timeout angular realize change has happened in next event loop.

you're staring down barrel of angular $q bug. can read here if wish.

that won't as following advice in my answer related stackoverflow question in show , describe adapter q.js promise $q promise.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -