當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript router.LocationStrategy類代碼示例

本文整理匯總了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);
      });
    });
  }));
開發者ID:DrMabuse23,項目名稱:react-native-renderer,代碼行數:39,代碼來源:router_spec.ts

示例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);
 });
開發者ID:DrMabuse23,項目名稱:react-native-renderer,代碼行數:9,代碼來源:router_spec.ts

示例3: back

 back(): void {
     this.locationStrategy.back();
 }
開發者ID:spencersmb,項目名稱:ng2book-routes,代碼行數:3,代碼來源:TrackComponent.ts

示例4: back

 back()
 {
     this._locationstrategy.back();
 }
開發者ID:rdrahul,項目名稱:Music-App-Angular2,代碼行數:4,代碼來源:artist.component.ts

示例5:

 _goBack() {
   this._locationStrategy.back();
 }
開發者ID:DrMabuse23,項目名稱:react-native-renderer,代碼行數:3,代碼來源:router.ts

示例6: back

 back():void{
     this._locationstrategy.back();
 }
開發者ID:rdrahul,項目名稱:Music-App-Angular2,代碼行數:3,代碼來源:album.component.ts


注:本文中的angular2/router.LocationStrategy類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。