当前位置: 首页>>代码示例>>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;未经允许,请勿转载。