当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript router.RouteParams类代码示例

本文整理汇总了TypeScript中@ngrx/router.RouteParams的典型用法代码示例。如果您正苦于以下问题:TypeScript RouteParams类的具体用法?TypeScript RouteParams怎么用?TypeScript RouteParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RouteParams类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: constructor

  constructor(
    private store: Store<AppState>,
    private albumActions: AlbumActions,
    private routeParams$: RouteParams,
    private _router:Router
  ) {

   routeParams$.select<string>('trackId').subscribe(value =>{
            this.currentAlbumTrackId = value;
          });

    this.album$ = routeParams$
      .select<string>('trackId')
      .switchMap(trackId => store.let(getAlbum(trackId)));

    this.isAlbumInCollection$ = routeParams$
      .select<string>('trackId')
      .switchMap(trackId => store.let(isAlbumInCollection(trackId)));

    this.collectionChange = store.let( getCollectionState());


    this.collectionChange.subscribe(state =>{
             console.log("[audioartist-viewpage.t audioBuffer audioItemState ="+ state.trackIds.includes(this.currentAlbumTrackId));
              if(state.trackIds.includes(this.currentAlbumTrackId)){
                  this._router.go('/audioArtist/find')
             }
    });
  }
开发者ID:willSonic,项目名称:ngrx2-tester,代码行数:29,代码来源:audioartist-view-page.ts

示例2: constructor

  constructor(
    private store: Store<AppState>,
    private bookActions: BookActions,
    private routeParams$: RouteParams
  ) {
    this.book$ = routeParams$
      .select<string>('id')
      .switchMap(id => store.let(getBook(id)));

    this.isBookInCollection$ = routeParams$
      .select<string>('id')
      .switchMap(id => store.let(isBookInCollection(id)));
  }
开发者ID:bkinsey808,项目名称:ngrx-graphql-experiment,代码行数:13,代码来源:book-view.ts

示例3: constructor

  constructor(
    private store: Store<AppState>,
    private cubeActions: CubeActions,
    private routeParams$: RouteParams
  ) {
    this.cube$ = routeParams$
      .select<string>('id')
      .switchMap(id => store.let(getCube(id)));

    this.isCubeInCollection$ = routeParams$
      .select<string>('id')
      .switchMap(id => store.let(isCubeInCollection(id)));
  }
开发者ID:mlukasch,项目名称:indigo,代码行数:13,代码来源:cube-view.ts

示例4: constructor

 constructor(private classRoomService: ClassRoomService, params$: RouteParams,
   private router: Router, private subjectService: SubjectService,
   private teacherService: TeacherService,
   private toastyService: ToastyService,
   private classRoomSubjectService: ClassRoomSubjectService) {
   params$.pluck<number>('id').subscribe(id => this.id = id);
 }
开发者ID:enyachoke,项目名称:SavannahAcademia,代码行数:7,代码来源:class-room.component.ts

示例5: constructor

 constructor(routeParams: RouteParams,
             private hotelService: HotelService,
             private router: Router) {
   this.hotelId = routeParams.pluck<number>('id');
   this.hotelId
     .filter(id => !isNaN(id))
     .flatMap(id => this.hotelService.getHotelAuthenticated(id)).subscribe(hotel => {
     this.hotel = hotel;
   });
 }
开发者ID:danielsuter,项目名称:ng2-camp,代码行数:10,代码来源:hotel-detail.component.ts

示例6: ngOnInit

	// I get called once when the component has been instantiated, after the inputs have
	// been bound for the first time.
	public ngOnInit() : void {

		this.projectSubscription = this.routeParams
			.pluck<string>( "projectId" )
			.distinctUntilChanged()
			.switchMap(
				( projectId: string ) : Observable<{}> => {

					this.isLoading = true;
					this.projectId = +projectId;

					return(
						Observable.forkJoin(
							this.projectService.getProjectById( this.projectId ),
							this.screenService.getScreensByProjectId( this.projectId )
						)
					);
					
				}
			)
			.subscribe(
				( results: [ IProject, IScreen[] ] ) : void => {

					this.isLoading = false;
					this.project = results[ 0 ];
					this.screens = results[ 1 ];
					this.selectContextScreen();

				},
				( error: any ) : void => {

					this.router.go( "/" );

				}
			)
		;

		this.screensSubscription = this.routeParams
			.pluck<string>( "screenId" )
			.distinctUntilChanged()
			.subscribe(
				( screenId: string ) : void => {

					this.screenId = +screenId;
					this.selectContextScreen();

				}
			)
		;

	}
开发者ID:bennadel,项目名称:JavaScript-Demos,代码行数:53,代码来源:console-view.component.ts

示例7: ngOnInit

  ngOnInit() {
    const uid = this.store.currentUser.uid;

    /* URLからidを取得する */
    this.store.disposable = this.params$.pluck<string>('id')
      .do(noteid => {
        if (noteid) {
          /* 保存済みnoteを呼び出す */
          this.store.disposable = this.service.readNote$(noteid)
            .do(note => {
              this.note = note;
              this.oldNote = lodash.cloneDeep(this.note);
              this.cd.markForCheck();
            })
            .subscribe();
        } else {
          /* noteを新規作成 */
          this.note = this.service.createNote();
          this.oldNote = lodash.cloneDeep(this.note);
          this.cd.markForCheck();
        }
      })
      .subscribe();

    /* キー入力がある度にnoteを保存する */
    this.store.disposable = Observable.fromEvent<KeyboardEvent>(this.el.nativeElement, 'keyup')
      .debounceTime(1000)
      .do(() => {
        this.service.writeNote(this.note, this.oldNote);
      })
      .subscribe();
  }
开发者ID:ovrmrw,项目名称:jspm-angular2-sample,代码行数:32,代码来源:note.component.ts

示例8: ngOnInit

	// I get called once when the component has been instantiated, after the inputs have
	// been bound for the first time.
	public ngOnInit() : void {

		this.routeParamsSubscription = this.routeParams
			.pluck<string>( "projectId" )
			.distinctUntilChanged()
			.switchMap(
				( value: string ) : Observable<IProject> => {

					this.isLoading = true;

					return( this.projectService.getProjectById( +value ) );

				}
			)
			.subscribe(
				( project: IProject ) : void => {

					this.isLoading = false;
					this.project = project;

				},
				( error: any ) : void => {

					this.router.go( "/projects", { notFound: true } );

				}
			)
		;

	}
开发者ID:bennadel,项目名称:JavaScript-Demos,代码行数:32,代码来源:detail-view.component.ts

示例9: ngOnInit

	// I get called once when the component has been instantiated, after the inputs have
	// been bound for the first time.
	public ngOnInit() : void {

		this.queryParamsSubscription = this.queryParams
			.pluck<string>( "filter" )
			.distinctUntilChanged()
			.filter(
				( filter: string ) : boolean => {

					return( this.filter !== ( filter || "" ) );

				}
			)
			.subscribe(
				( filter: string ) : void => {

					this.filter = ( filter || "" );
					this.applyFilter();

				}
			)
		;

		this.routeParamsSubscription = this.routeParams
			.pluck<string>( "projectId" )
			.distinctUntilChanged()
			.switchMap(
				( value: string ) : Observable<IScreen[]> => {

					this.isLoading = true;

					return( this.screenService.getScreensByProjectId( +value ) );

				}
			)
			.subscribe(
				( screens: IScreen[] ) : void => {

					this.isLoading = false;
					this.screens = screens;
					this.filteredScreens = this.screens.map(
						( screen: IScreen ) : IFilteredScreen => {

							return({
								screen: screen,
								tags: [ screen.name.toLowerCase(), screen.filename.toLowerCase() ],
								visible: false,
								column: 0
							});

						}
					);

					this.applyFilter();

				}
			)
		;

	}
开发者ID:bennadel,项目名称:JavaScript-Demos,代码行数:61,代码来源:screens-view.component.ts

示例10: ngOnInit

	// I get called once when the component has been instantiated, after the inputs have
	// been bound for the first time.
	public ngOnInit() : void {

		this.routeParamsSubscription = this.routeParams
			.pluck<string>( "projectId" )
			.distinctUntilChanged()
			.subscribe(
				( value: string ) : void => {

					this.projectId = +value;

				}
			)
		;

	}
开发者ID:bennadel,项目名称:JavaScript-Demos,代码行数:17,代码来源:comments-view.component.ts


注:本文中的@ngrx/router.RouteParams类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。