本文整理匯總了TypeScript中angular2/platform/common.Location.path方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Location.path方法的具體用法?TypeScript Location.path怎麽用?TypeScript Location.path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular2/platform/common.Location
的用法示例。
在下文中一共展示了Location.path方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getLinkStyle
getLinkStyle(path) {
if(path === this.location.path()){
return true;
}
else if(path.length > 0){
return this.location.path().indexOf(path) > -1;
}
}
示例2: it
it('should incorporate the provided query values into the location change', () => {
var locationStrategy = new MockLocationStrategy();
var location = new Location(locationStrategy);
location.go('/home', "key=value");
expect(location.path()).toEqual("/home?key=value");
});
示例3: showGradient
showGradient(): boolean {
var currentPath = this.location.path();
// If we're in a room-related path
if (currentPath.indexOf('/room') === 0) {
// Show gradient if it's the "new room"" component
return currentPath.indexOf('/room/new') === 0;
} else {
return true;
}
}
示例4: expect
router.navigateByUrl('/weather').then(() => {
expect(location.path()).toBe('/weather');
done();
}).catch(e => done.fail(e));
示例5: getLinkStyle
getLinkStyle(path) {
return this.location.path().indexOf(path) > -1;
}
示例6: assertUrl
function assertUrl(path) { expect(location.path()).toEqual(path); }
示例7:
return state$ => state$.do(s => {
if (s.router.init && (s.router.navigating || s.router.url !== location.path())) {
router.navigateByUrl(s.router.url);
}
});