阅读背景:

如何使用$q从AngularJS服务返回已解决的承诺?

来源:互联网 

My service is:

我的服务是:

myApp.service('userService', [
  '$http', '$q', '$rootScope', '$location', function($http, $q, $rootScope, $location) {
    var deferred;
    deferred = $q.defer();
    this.initialized = deferred.promise;
    this.user = {
      access: false
    };
    this.isAuthenticated = function() {
      this.user = {
        first_name: 'First',
        last_name: 'Last',
        email: '[email protected]',
        access: 'institution'
      };
      return deferred.resolve();
    };
  }
]);
myApp.service('userSe



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: