Ok, I've found the
following:
http://phonegap-tips.com/articles/conditional-dependency-injection-with-angularjs.html
So I've created the following:
angular.module('itaas').factory('UserContent', ['$injector', 'user',
function ($injector, user) {
if (user.isAuthenticated)
return $injector.get('UserContentApi');
return $injector.get('UserContentFake');
}])
One factory for when user is logged in, one factory for when user is not
logged in, so I don't have to add a lot of *if* statements throughout the
code.
That works, however, when user authenticates, I'd want to *change the
factory instance* to be *UserContentApi* instead of *UserContentFake*.
Is this possible?
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.