I am not able to set onhashchange property using angular 4, i tried to set onhashchange in the following life cycle of the angular 4 but it is not working.
ngAfterContentInit
ngAfterContentInit() {
//disabling browser back button
window.location.hash = "lienholder-details";
window.location.hash = "Again-lienholder-details";//again because google chrome don't insert first hash into history
window.onhashchange = function () { window.location.hash = "lienholder-details"; }
}
ngOnInit
ngOnInit(){
//disabling browser back button
window.location.hash = "lienholder-details";
window.location.hash = "Again-lienholder-details";//again because google chrome don't insert first hash into history
window.onhashchange = function () { window.location.hash = "lienholder-details"; }
}
how to set the onhashchange property in angular 4