I have an Injectable Class and a Component class. All I need to do is to call a function in the Component Class from the Injectable class.
INJECTABLE:
Injectable()
export class theInjected
{
constructor(private afAuth: AngularFireAuth, private googlePlus: GooglePlus, public alertCtrl: AlertController){
this.afAuth.authState.subscribe(user =>
{
if(user)
{
this.user = this.afAuth.authState; //this means alert('fire user logged in');
//
// I need to call the function here goTopage();
//
}
else
{
Observable.of(null); //this means alert('fire user logged out');
}
}
);
}
}
COMPONENT:
@Component({
selector: 'home',
templateUrl: 'home.html'
})
export class Home
{
constructor(public injected: theInjected){
}
goTopage()
{
this.navCtrl.setRoot(this.loggedInPage);
}
}
I simply want a way to call a function existing in a component class from a Injectable.
Thanks!