Cannot inject custom provider to Resource after updating to 2.1.0
desfero opened this issue · 2 comments
desfero commented
Hello,
after upgrading to 2.1.0 Injector
was removed from Resource
class, but i used it for injecting my custom dependency do an AuthResource
.
export class AuthResource extends Resource {
constructor(http: Http,
injector: Injector) {
super(http, injector);
const headersService = injector.get(HeadersService);
// ...
}
do we have any options to get same functionality after this change?
troyanskiy commented
Hello.
Yes, the Injector has been removed from Resource.
Please try to do like that
@ResourceParams({
...
add2Provides: false
})
export class AuthResource extends Resource {
constructor(http: Http,
private headersService: HeadersService) {
super(http);
// ...
}
Add the resource class to your app providers list.