I am new to angular js2. Currently I am working with a web application, which uses angular2 for front-end. In this application I have used angular2-social-login for authentication purpose. But when I run the npm start I got the below error
ERROR in Error encountered resolving symbol values statically. Calling function 'Angular2SocialLoginModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /var/www/html/ngtest/src/app/app.module.ts, resolving symbol AppModule in /var/www/html/ngtest/src/app/app.module.ts
When I google it, some one says that it is beacause of using angular cli in the project. But I uninstalled angular cli, still problem persists. Did any one know how to solve this issue?
My app.module.ts code is below
import { Angular2SocialLoginModule } from "angular2-social-login";
let providers = {
"facebook": {
"clientId": "xxxxxxxxxxxxx",
"apiVersion": "v2.8"
},
"linkedin": {
"clientId": "xxxxxxxxxxx"
},
"google": {
"clientId": "xxxxxxxxxx"
}
};
@NgModule({
imports: [
Angular2SocialLoginModule.initWithProviders(providers),
],
})
export class AppModule { }
I have called this module in header.component.ts, please see the header.component.ts file
import { AuthService } from "angular2-social-login";
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.css'],
providers: [Modal]
})
export class HeaderComponent implements OnInit {
constructor(public _auth: AuthService){ }
signIn(provider){
this.sub = this._auth.login(provider).subscribe(
(data) => {
console.log(data);
}
)}
logout(){
this._auth.logout().subscribe(
(data)=>{
//return a boolean value.
}
)}
}
The above is my code, Please have a look. If any more details needed please comment
It worked for me.
Update
In angular2-social-login v.3.0.0 you can write:
Old version
Remove
And try this:
Another solution to fix the above problem: