Error: Can't resolve all parameters for AuthService: (?).

Mar 16 2021 12:39 AM
My code is here
 
component.ts
  1. import { Component, Injectable, OnInit } from '@angular/core';  
  2. import { GoogleLoginProvider, FacebookLoginProvider, AuthService } from 'angular-6-social-login';  
  3. import { SocialLoginModule, AuthServiceConfig } from 'angular-6-social-login';  
  4. declare var FB: any  
  5. @Component({  
  6. selector: 'app-signup',  
  7. templateUrl: './signup.component.html',  
  8. styleUrls: ['./signup.component.css']  
  9. })  
  10. export class SignupComponent implements OnInit {  
  11. toastr: any;  
  12. auth2: any;  
  13. constructor( public authService: AuthService  
  14. ) { }  
  15. ngOnInit(): void {  
  16. (window as any).fbAsyncInit = function () {  
  17. FB.init({  
  18. appId: '277072117153996',  
  19. cookie: true,  
  20. xfbml: true,  
  21. version: 'v3.10'  
  22. });  
  23. FB.AppEvents.logPageView();  
  24. };  
  25. (function (d, s, id) {  
  26. var js, fjs = d.getElementsByTagName(s)[0];  
  27. if (d.getElementById(id)) { return; }  
  28. js = d.createElement(s); js.id = id;  
  29. js.src = "https://connect.facebook.net/en_US/sdk.js";  
  30. fjs.parentNode.insertBefore(js, fjs);  
  31. }(document, 'script''facebook-jssdk'));  
  32. }  
  33. fblogin() {  
  34. console.log("submit login to facebook");  
  35. // FB.login();  
  36. FB.login((response) => {  
  37. console.log('submitLogin', response);  
  38. if (response.authResponse) {  
  39. console.log('login successful''Success!');  
  40. }  
  41. else {  
  42. console.log('User login failed');  
  43. }  
  44. });  
  45. }  
  46. Google_signin() {  
  47. let socialPlatformProvider;  
  48. socialPlatformProvider = GoogleLoginProvider.PROVIDER_ID;  
  49. this.authService.signIn(socialPlatformProvider).then(google_user => {  
  50. console.log(google_user);  
  51. })  
  52. }  
  53. Upload_img() {  
  54. }  
  55. }  
Module.ts
  1. import { NgModule } from '@angular/core';  
  2. import { FormsModule } from '@angular/forms';  
  3. import { BrowserModule } from '@angular/platform-browser';  
  4. import { RouterModule, Routes } from '@angular/router';  
  5. import { AppComponent } from './app.component';  
  6. import { SignupComponent } from './signup/signup.component';  
  7. import { HomeComponent } from './home/home.component';  
  8. import {HttpClientModule} from '@angular/common/http';  
  9. import { AuthService, GoogleLoginProvider } from 'angular-6-social-login';  
  10. import { SocialLoginModule, AuthServiceConfig } from 'angular-6-social-login';  
  11. export function socialConfigs() {  
  12. const config = new AuthServiceConfig(  
  13. [  
  14. {  
  15. id: GoogleLoginProvider.PROVIDER_ID,  
  16. provider: new GoogleLoginProvider('149457059037-t9i75j5mnrmvguoq6795s6ausudmsgq4.apps.googleusercontent.com')  
  17. }  
  18. ]  
  19. );  
  20. return config;  
  21. }  
  22. const ROUTES:Routes=[  
  23. {path:"signup",component:SignupComponent}  
  24. ]  
  25. @NgModule({  
  26. declarations: [  
  27. AppComponent,  
  28. SignupComponent,  
  29. HomeComponent  
  30. ],  
  31. imports: [  
  32. BrowserModule,  
  33. RouterModule.forRoot(ROUTES),  
  34. FormsModule,  
  35. HttpClientModule  
  36. ],  
  37. providers: [  
  38. AuthService,  
  39. {  
  40. provide: AuthServiceConfig,  
  41. useFactory: socialConfigs  
  42. }  
  43. ],  
  44. bootstrap: [AppComponent]  
  45. })  
  46. export class AppModule { }  

Answers (5)