I am trying to login with google but when i press the button i get an error , i print the error from AuthService Class and the error i get is: "Could not attach click handler to the element. Reason: element not found"
this is my code:
import { Component, Injectable} from '@angular/core';
import { AuthService, AppGlobals } from 'angular2-google-login';
import { BrowserModule } from '@angular/platform-browser';
import { AfterViewInit } from '@angular/core';
@Injectable()
class User {
email: string;
password: string;
}
@Component({
selector: 'cv-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css'],
providers: [AuthService, User]
})
export class LoginComponent {
user: User;
sub: any;
constructor(private _auth: AuthService) {
AppGlobals.GOOGLE_CLIENT_ID = 'XXXXX.apps.googleusercontent.com';
this.user = new User();
}
ngOnInit() {
}
signIn() {
this._auth.authenticateUser(() => {
console.log("login");
});
}
logout() {
this._auth.userLogout(() => {
console.log("logout");
});
}
}
html:
<h1>Angular2 Social login</h1>
<button (click)="signIn('google')">google</button>
<button (click)="logout()">logout</button>
<div *ngIf="user">
<table>
<tr>
<td>Email</td>
<td>{{user.email}}</td>
</tr>
</table>
</div>
what i am asking is a little direction or fix of my problem thanks.