[英]Path not detected after HashLocationStrategy and Location Strategy Import.Angular 2 & Typescript
if (location.pathname.includes('aboutUs')) {
this.isShow = false;
}
You can use this approach to work with ActivatedRoute
, paths, and get url params and query params. 您可以使用此方法来使用
ActivatedRoute
,路径,并获取url参数和查询参数。
export class YourComponent {
constructor(private activatedRoute: ActivatedRoute) { }
this.activatedRoute.url.subscribe(urlSegments => {
for (const item of urlSegments) {
if (item.path === 'aboutUs') {
console.log('Awesome! Path Found...');
}
}
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.