本文整理汇总了TypeScript中angular2/router.LocationStrategy类的典型用法代码示例。如果您正苦于以下问题:TypeScript LocationStrategy类的具体用法?TypeScript LocationStrategy怎么用?TypeScript LocationStrategy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LocationStrategy类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should navigate back', injectAsync([TestComponentBuilder, ReactNativeRootRenderer], (tcb: TestComponentBuilder, _rootRenderer: ReactNativeRootRenderer) => {
var rootRenderer = _rootRenderer;
var router: Router;
var location: LocationStrategy;
return tcb.createAsync(TestComponent).then((fixture: ComponentFixture) => {
router = fixture.componentInstance.router;
location = fixture.componentInstance.location;
fixture.detectChanges();
rootRenderer.executeCommands();
mock.clearLogs();
return new Promise((resolve: any) => {
setTimeout(() => {
rootRenderer.executeCommands();
expect(mock.commandLogs.toString()).toEqual(
'CREATE+5+cmp-a+{},CREATE+6+native-text+{},CREATE+7+native-rawtext+{"text":"a"},ATTACH+6+7+0,ATTACH+5+6+0,ATTACH+3+5+1');
mock.clearLogs();
router.navigateByUrl('/b')
.then((_: any) => {
rootRenderer.executeCommands();
expect(mock.commandLogs.toString()).toEqual(
'CREATE+8+cmp-b+{},CREATE+9+native-text+{},CREATE+10+native-rawtext+{"text":"b"},DETACH+3+1,ATTACH+3+8+1,ATTACH+9+10+0,ATTACH+8+9+0');
mock.clearLogs();
})
.then((_: any) => {
location.back();
setTimeout(() => {
rootRenderer.executeCommands();
expect(mock.commandLogs.toString()).toEqual(
'CREATE+11+cmp-a+{},CREATE+12+native-text+{},CREATE+13+native-rawtext+{"text":"a"},DETACH+3+1,ATTACH+3+11+1,ATTACH+12+13+0,ATTACH+11+12+0');
resolve();
}, 30);
});
}, 0);
});
});
}));
示例2: setTimeout
.then((_: any) => {
location.back();
setTimeout(() => {
rootRenderer.executeCommands();
expect(mock.commandLogs.toString()).toEqual(
'CREATE+11+cmp-a+{},CREATE+12+native-text+{},CREATE+13+native-rawtext+{"text":"a"},DETACH+3+1,ATTACH+3+11+1,ATTACH+12+13+0,ATTACH+11+12+0');
resolve();
}, 30);
});
示例3: back
back(): void {
this.locationStrategy.back();
}
示例4: back
back()
{
this._locationstrategy.back();
}
示例5:
_goBack() {
this._locationStrategy.back();
}
示例6: back
back():void{
this._locationstrategy.back();
}