angular-es6
angular-es6 copied to clipboard
Are you sure the factory works correctly?
class ThingFactory {
/*@ngInject*/
constructor($timeout) {
this.$timeout = $timeout;
}
newThing() {
console.log('Getting a new Thing...');
return this.$timeout(() => new Thing(), 100);
}
}
register('app').factory('thingFactory', ThingFactory);
In my app, newThing() doesn't have access to ThingFactory object's this. Rather this points to window.
I think this is more specific to intercept handlers:
http://stackoverflow.com/questions/28638600/angularjs-http-interceptor-class-es6-loses-binding-to-this
^ This is the exact problem I'm experiencing. Maybe nothing to do with you register function.