本文整理匯總了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();
}