我试图使用typescript函数中的location.go服务导航到特定的URL.它会更改浏览器中的URL,但URL的组件不会反映在屏幕中.它保留在登录(实际)屏幕上 - 例如:
constructor(location: Location, public _userdetails: userdetails){
this.location = location;
}
login(){
if (this.username && this.password){
this._userdetails.username = this.username;
this.location.go('/home');
}
else{
console.log('Cannot be blank');
}
}
Run Code Online (Sandbox Code Playgroud)
我缺少一个编译方法或刷新方法吗?