I have a service:
import {Injectable} from '@angular/core';
import {Subject} from "rxjs";
@Injectable()
export class AuthTracker {
public loginNotifier: Subject<boolean>;
}
When I import into my component, the authTracker param is just an empty object (no “loginNotifier” property):
import {NavController} from "ionic-angular";
import {AuthTracker} from '../../providers/authentication/auth-tracker';
import {Injectable, Component} from "@angular/core";
import {LoginPage} from "./login";
import {HelloIonicPage} from "../../pages/hello-ionic/hello-ionic";
@Component({
template: ''
})
export class DispatchPage {
constructor(nav: NavController, authTracker: AuthTracker) {
let logsub = (loggedin) => {
if (loggedin) {
nav.setRoot(HelloIonicPage);
} else {
nav.setRoot(LoginPage);
}
};
authTracker.loginNotifier.subscribe(logsub);
}
}
I have the AuthTracker token provided in bootstrap:
ionicBootstrap(MyApp,[AuthTracker]);
No errors coming up. Please, what am I missing?