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


TypeScript RouteParams.pluck方法代碼示例

本文整理匯總了TypeScript中@ngrx/router.RouteParams.pluck方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript RouteParams.pluck方法的具體用法?TypeScript RouteParams.pluck怎麽用?TypeScript RouteParams.pluck使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@ngrx/router.RouteParams的用法示例。


在下文中一共展示了RouteParams.pluck方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: constructor

 constructor(private gradingLevelService: GradingLevelService, params$: RouteParams,
   router: Router, private toastyService: ToastyService) {
   params$.pluck<number>('id').subscribe(id => this.id = id);
 }
開發者ID:enyachoke,項目名稱:SavannahAcademia,代碼行數:4,代碼來源:grading-level.component.ts

示例9: constructor

 constructor(routeParams$:RouteParams) {
   this.idParam$ = routeParams$.pluck<string>('id');
 }
開發者ID:Davidvdv,項目名稱:ng2-lazy,代碼行數:3,代碼來源:child2.ts

示例10: constructor

 constructor(private examPeriodService: ExamPeriodService, params$: RouteParams,
   router: Router, private termService: TermService, private toastyService: ToastyService) {
   params$.pluck<number>('id').subscribe(id => this.id = id);
 }
開發者ID:enyachoke,項目名稱:SavannahAcademia,代碼行數:4,代碼來源:exam-period.component.ts


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