This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constructor(private router: Router){ | |
// override the route reuse strategy | |
this.router.routeReuseStrategy.shouldReuseRoute = function(){ | |
return false; | |
} | |
this.router.events.subscribe((evt) => { | |
if (evt instanceof NavigationEnd) { | |
// trick the Router into believing it's last link wasn't previously loaded | |
this.router.navigated = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deepSearch(object, key, predicate) { | |
if (object.hasOwnProperty(key) && predicate(key, object[key]) === true) | |
return object; | |
for (let i = 0; i < Object.keys(object).length; i++) { | |
let value = object[Object.keys(object)[i]]; | |
if (typeof value === "object" && value != null) { | |
let o = this.deepSearch(object[Object.keys(object)[i]], key, predicate); | |
if (o != null) return o; | |
} |