no message

This commit is contained in:
annabakouli 2017-12-07 15:36:12 +02:00
parent 73c38f3ff3
commit b8a3917522
4 changed files with 36 additions and 42 deletions

View File

@ -35,45 +35,8 @@ export class AppComponent implements OnInit {
}
ngOnInit() {
//this.initiateExternalProviders();
}
initiateExternalProviders(){
//initiate google
var clientId = '1010962018903-glegmqudqtl1lub0150vacopbu06lgsg.apps.googleusercontent.com';
var scope = [
'profile',
'email'
].join(' ');
if(gapi.auth2 == undefined){
gapi.load('auth2', () => {
gapi.auth2.init({
client_id: clientId,
cookiepolicy: 'single_host_origin',
scope: scope
});
//RE-Render the button (due to known issues of google-button with angular's lifecycle)
gapi.signin2.render('googleBtn');
//var buttonElement = this.element.nativeElement.querySelector('#googleBtn');
//this.attachSignin(buttonElement);
});
}
}
slideNav(){
$("#appSidebar").toggleClass("expanded");

View File

@ -2,7 +2,7 @@
<table class="table">
<tbody>
<tr align="center">
<div class="g-signin2" id="googleBtn"></div>
<div class="g-signin2" id="googleBtn"></div>
</tr>
</tbody>
</table>

View File

@ -14,7 +14,7 @@ declare function simple_notifier(type: string, title: string, message:string): a
templateUrl: './googgle-sign-in.component.html',
styleUrls: ['./googgle-sign-in.component.css']
})
export class GooggleSignInComponent implements OnInit, AfterViewInit, Injectable {
export class GooggleSignInComponent implements OnInit, Injectable {
@ -22,17 +22,47 @@ export class GooggleSignInComponent implements OnInit, AfterViewInit, Injectable
}
ngOnInit() {
this.initiateExternalProviders();
}
initiateExternalProviders(){
var clientId = '1010962018903-glegmqudqtl1lub0150vacopbu06lgsg.apps.googleusercontent.com';
var scope = [
'profile',
'email'
].join(' ');
if(gapi.auth2 == undefined){
gapi.load('auth2', () => {
gapi.auth2.init({
client_id: clientId,
cookiepolicy: 'single_host_origin',
scope: scope
}).then(()=>this.renderButton());
});
}else{
gapi.auth2.init({
client_id: clientId,
cookiepolicy: 'single_host_origin',
scope: scope
}).then(()=>this.renderButton());
}
}
ngAfterViewInit() {
renderButton() {
//RE-Render the button (due to known issues of google-button with angular's lifecycle)
gapi.signin2.render('googleBtn');
var buttonElement = this.element.nativeElement.querySelector('#googleBtn');
this.attachSignin(buttonElement);
if(buttonElement)this.attachSignin(buttonElement);
}

View File

@ -4,6 +4,7 @@ import { NativeLoginService } from '../../services/login/native-login.service';
import { TokenService, TokenProvider } from '../../services/login/token.service';
import {Router} from '@angular/router';
import {MenuItem} from 'primeng/primeng';
declare const gapi: any;
import '../../../assets/custom.js';
declare function simple_notifier(type: string, title: string, message:string): any;