i am trying to get google contacts in my angular 2 project here is my code please help me, thanks in advance. in component i done this:
googleContacts(){
this.contactService.googleLogin()
.subscribe(
response => {
this.logger.info("addContactComponent googleContacts(): "+ response);
window.location.href = ""+ response;
},
error => this.logger.error( error ),
() => this.logger.info( "google_contacts() finished" )
)
}
and in service i done like this:
googleLogin():Observable<Response> {
this.logger.info(this.googleContactsUrl+"authorizeLogin?access_token=" + this.authenticationService.access_token);
return this._http.get(this.googleContactsUrl+"authorizeLogin?access_token=" + this.authenticationService.access_token)
.map((response: any) => response);
}
and in html:
<button style="margin: -8px; background-color: white" (click) = "googleContacts()"></button >