TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Preetham Holenarasipuradevera
NA
75
12.5k
Error: Can't resolve all parameters for AuthService: (?).
Mar 16 2021 12:39 AM
My code is here
component.ts
import
{ Component, Injectable, OnInit } from
'@angular/core'
;
import
{ GoogleLoginProvider, FacebookLoginProvider, AuthService } from
'angular-6-social-login'
;
import
{ SocialLoginModule, AuthServiceConfig } from
'angular-6-social-login'
;
declare
var
FB: any
@Component({
selector:
'app-signup'
,
templateUrl:
'./signup.component.html'
,
styleUrls: [
'./signup.component.css'
]
})
export
class
SignupComponent
implements
OnInit {
toastr: any;
auth2: any;
constructor(
public
authService: AuthService
) { }
ngOnInit():
void
{
(window as any).fbAsyncInit =
function
() {
FB.init({
appId:
'277072117153996'
,
cookie:
true
,
xfbml:
true
,
version:
'v3.10'
});
FB.AppEvents.logPageView();
};
(
function
(d, s, id) {
var
js, fjs = d.getElementsByTagName(s)[0];
if
(d.getElementById(id)) {
return
; }
js = d.createElement(s); js.id = id;
js.src =
"https://connect.facebook.net/en_US/sdk.js"
;
fjs.parentNode.insertBefore(js, fjs);
}(document,
'script'
,
'facebook-jssdk'
));
}
fblogin() {
console.log(
"submit login to facebook"
);
// FB.login();
FB.login((response) => {
console.log(
'submitLogin'
, response);
if
(response.authResponse) {
console.log(
'login successful'
,
'Success!'
);
}
else
{
console.log(
'User login failed'
);
}
});
}
Google_signin() {
let socialPlatformProvider;
socialPlatformProvider = GoogleLoginProvider.PROVIDER_ID;
this
.authService.signIn(socialPlatformProvider).then(google_user => {
console.log(google_user);
})
}
Upload_img() {
}
}
Module.ts
import
{ NgModule } from
'@angular/core'
;
import
{ FormsModule } from
'@angular/forms'
;
import
{ BrowserModule } from
'@angular/platform-browser'
;
import
{ RouterModule, Routes } from
'@angular/router'
;
import
{ AppComponent } from
'./app.component'
;
import
{ SignupComponent } from
'./signup/signup.component'
;
import
{ HomeComponent } from
'./home/home.component'
;
import
{HttpClientModule} from
'@angular/common/http'
;
import
{ AuthService, GoogleLoginProvider } from
'angular-6-social-login'
;
import
{ SocialLoginModule, AuthServiceConfig } from
'angular-6-social-login'
;
export
function
socialConfigs() {
const
config =
new
AuthServiceConfig(
[
{
id: GoogleLoginProvider.PROVIDER_ID,
provider:
new
GoogleLoginProvider(
'149457059037-t9i75j5mnrmvguoq6795s6ausudmsgq4.apps.googleusercontent.com'
)
}
]
);
return
config;
}
const
ROUTES:Routes=[
{path:
"signup"
,component:SignupComponent}
]
@NgModule({
declarations: [
AppComponent,
SignupComponent,
HomeComponent
],
imports: [
BrowserModule,
RouterModule.forRoot(ROUTES),
FormsModule,
HttpClientModule
],
providers: [
AuthService,
{
provide: AuthServiceConfig,
useFactory: socialConfigs
}
],
bootstrap: [AppComponent]
})
export
class
AppModule { }
Reply
Answers (
5
)
What is the usage of bundle files in Angular?
Calling WebApi with dataset in angular