check if data exists

This commit is contained in:
Cilibiu Bogdan
2019-07-12 08:54:36 +03:00
parent 026157b892
commit 120c030b2b
@@ -58,7 +58,7 @@ import { Router } from '@angular/router';
export class ToggleFavoriteComponent implements OnInit { export class ToggleFavoriteComponent implements OnInit {
@Input() data: any; @Input() data: any;
selection$: Observable<SelectionState>; selection$: Observable<SelectionState>;
private reloadOnRoutes: string[]; private reloadOnRoutes: string[] = [];
constructor( constructor(
private store: Store<AppStore>, private store: Store<AppStore>,
@@ -69,10 +69,12 @@ export class ToggleFavoriteComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
if (this.data) {
this.reloadOnRoutes = this.extensionService.runExpression( this.reloadOnRoutes = this.extensionService.runExpression(
`$( ${this.data} )` `$( ${this.data} )`
); );
} }
}
onToggleEvent() { onToggleEvent() {
if (this.reloadOnRoutes.includes(this.router.url)) { if (this.reloadOnRoutes.includes(this.router.url)) {