-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No provider for Http! #28
Comments
Can you try passing Http to the ...
import {Http} from 'angular2/http';
...
provide(AuthHttp, {
useFactory: (http) => {
return new AuthHttp(new AuthConfig(), http);
},
deps: [Http]
})
... Let me know if that works :) |
That does it!!! Thank you! Never would have thought of doing that. It's been a month or so since I've started with Angular2-jws. Is there any mention of this approach in the docs? |
This is from a recent change. I'll update the readme to reflect it. Thanks! |
You should just be able to provide auth config and authhttp like this:
I believe when I pulled the injector out of the AuthHttp constructor I updated the example (though I used a factory and not a value). |
This is still not working on my side, beta.8 - i still get an exception: Cannot resolve all parameters for 'AuthConfig'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'AuthConfig' is decorated with Injectable. Error: Cannot read property 'getOptional' of undefined Even if i try to give him the local config param in my provide, the error won't go away. Are now actually Decorators missing in the current AuthConfig implementation? Update: I've just copied over the variant to bootstrap from the project page (angular2-jwt):
Now this variant is working, yay! :) I know, my strings i'm defining for all the values in my config object are total non-sense, i just wanted to make it running first.. but leaving them empty has taken me into another error again (can't remember which one right now) |
It doesn't need to be decorated if you use it via useValue, because you are instantiating it directly. Can you provide us with your entire bootstrap? Are you providing AuthConfig anywhere else? You can look at this plunk as well for ideas: http://plnkr.co/edit/pKazgpkXLX9ZgV02YuVf?p=preview |
Thx @escardin for your answer - we crossed each other, i've just made an update on my comment how i could fix it ;) |
I am getting the following error:
EXCEPTION: No provider for Http! (Login -> AuthHttp -> Http)
main.ts
login.ts
authService.ts
The text was updated successfully, but these errors were encountered: