Hi Try with something like this:
1 - Declare a Service like:
import { Observable } from 'rxjs/Observable';
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
@Injectable()
export class SharedService {
// Observable sources (change activity)
private emitChangeActivitySource = new Subject<any>();
// Observable streams (change activity)
changeActivityEmitted$ = this.emitChangeActivitySource.asObservable();
// Service (change activity)
emitChangeActivity(change: any) {
this.emitChangeActivitySource.next(change);
}
}
2- then when you want to get (subscribe ) for it:
import { SharedService } from '../shared/services/index';
@Component({
selector: 'app-dashboard',
templateUrl: './full-layout.component.html',
styleUrls: ['./full-layout.component.scss']
})
export class FullLayoutComponent {
constructor(private toasterService: ToasterService,
private currentUserService: CurrentUserService,
private menuService: MenuService,
private router: Router,
private auth: AuthService,
private _sharedService: SharedService,
private _activitiesService: ActivitiesService,
private _router: Router) {
_sharedService.changeActivityEmitted$.subscribe(
activity => {
this.data = activity;
}
});
}
}
3- where you want to trigger it:
this._sharedService.emitChangeActivitySource({name:'',descr:''});