Open marcusaaronb opened 6 years ago
@marcusaaronb I was also facing the same issue
later, I realized that I missed 'SocialLoginModule' to include in my main module. This might be the case for you as well.
@praveen-vasudhaika I am also facing the same issue. How did you get to resolve? Could you please brief? Thanks!
@as88425 I had missed to include > SocialLoginModule in imports under NgModule decorator on my main module:
@NgModule({
imports: [
...
SocialLoginModule
],
declarations: [...],
providers : [
{
provide: AuthServiceConfig,
useFactory: getAuthServiceConfigs
}
]
})
hope this helps!!
@praveen-vasudhaika as per your steps I also did in my signin.component.ts
@Component({
selector: 'app-signin',
templateUrl: './signin.component.html',
styleUrls: ['./signin.component.css'],
providers: [SocialLoginModule, AuthService]
})
it's workin for me now
Through normal angular build its working fine but when i used Webpack build , its throwing exception "Can't resolve all parameters in AppComponent (?) e.g AuthService"
Do you have any solution for this :)
import { Component, OnInit } from '@angular/core' import { SocialLoginModule } from 'angularx-social-login' import { AuthService } from "angularx-social-login"; import { GoogleLoginProvider } from "angularx-social-login"; import { SocialUser } from "angularx-social-login";
@Component({ selector: 'app-easy', templateUrl: '../../Scripts/Home/Components/appComponent.html', providers: [SocialLoginModule,AuthService] }) export class AppComponent implements OnInit { myName: string user: SocialUser loggedIn:boolean
constructor(private authService: AuthService) {
this.myName = "sujit"
}
getName = ()=> {
return this.myName
}
signInWithGoogle(): void {
this.authService.signIn(GoogleLoginProvider.PROVIDER_ID);
}
signOut(): void {
this.authService.signOut();
}
ngOnInit() {
this.authService.authState.subscribe((user) => {
this.user = user;
this.loggedIn = (user != null);
});
}
thanks for the hint you have provided @praveen-vasudhaika ,it save my day
core.js:6456 ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(LoginPageModule)[AuthService -> AuthService -> AuthService -> HttpService -> HttpClient -> HttpClient -> HttpClient]: NullInjectorError: No provider for HttpClient! NullInjectorError: R3InjectorError(LoginPageModule)[AuthService -> AuthService -> AuthService -> HttpService -> HttpClient -> HttpClient -> HttpClient]: NullInjectorError: No provider for HttpClient! at NullInjector.get (core.js:11081) at R3Injector.get (core.js:11247) at R3Injector.get (core.js:11247) at R3Injector.get (core.js:11247) at injectInjectorOnly (core.js:4728) at ɵɵinject (core.js:4732) at Object.HttpService_Factory [as factory] (ɵfac.js? [sm]:1) at R3Injector.hydrate (core.js:11416) at R3Injector.get (core.js:11236) at injectInjectorOnly (core.js:4728) at resolvePromise (zone.js:1255) at resolvePromise (zone.js:1209) at zone.js:1321 at ZoneDelegate.invokeTask (zone.js:434) at Object.onInvokeTask (core.js:28661) at ZoneDelegate.invokeTask (zone.js:433) at Zone.runTask (zone.js:205) at drainMicroTaskQueue (zone.js:620)
core.js:1448 ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[SigninComponent -> AuthService]: StaticInjectorError(Platform: core)[SigninComponent -> AuthService]: NullInjectorError: No provider for AuthService! Error: StaticInjectorError(AppModule)[SigninComponent -> AuthService]: StaticInjectorError(Platform: core)[SigninComponent -> AuthService]: NullInjectorError: No provider for AuthService! at NullInjector.get (core.js:1002) at resolveToken (core.js:1300) at tryResolveToken (core.js:1242) at StaticInjector.get (core.js:1110) at resolveToken (core.js:1300) at tryResolveToken (core.js:1242) at StaticInjector.get (core.js:1110) at resolveNgModuleDep (core.js:10854) at NgModuleRef.get (core.js:12087) at resolveDep (core.js:12577) at NullInjector.get (core.js:1002) at resolveToken (core.js:1300) at tryResolveToken (core.js:1242) at StaticInjector.get (core.js:1110) at resolveToken (core.js:1300) at tryResolveToken (core.js:1242) at StaticInjector.get (core.js:1110) at resolveNgModuleDep (core.js:10854) at NgModuleRef.get (core.js:12087) at resolveDep (core.js:12577) at resolvePromise (zone.js:809) at resolvePromise (zone.js:775) at eval (zone.js:858) at ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:4740) at ZoneDelegate.invokeTask (zone.js:420) at Zone.runTask (zone.js:188) at drainMicroTaskQueue (zone.js:595) at