I can’t understand what I’m doing wrong here? this is my contructor
constructor(public navCtrl: NavController,
private dateService: DateService,
private _emit:EmitterService) {
_emit.navItem$.subscribe(item => {
console.log('test')
this.formattedDate = this.formatDateView(this.dateService.getDate());
})
this.changeDate = function(type: String): void {
this.navCtrl.push(DateChange)
}
and this is the service which emits
import {Injectable} from '@angular/core'
import {Subject} from 'rxjs/Subject';
@Injectable()
export class EmitterService {
// Observable navItem source
private _navItemSource = new Subject<Object>();
// Observable navItem stream
navItem$ = this._navItemSource.asObservable();
// service command
changeNav(item: Object): void {
this._navItemSource.next("item");
}
}
I console and checked that changeNav is being called but it does not get subscribed