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


TypeScript router.RouteParams類代碼示例

本文整理匯總了TypeScript中angular2/router.RouteParams的典型用法代碼示例。如果您正苦於以下問題:TypeScript RouteParams類的具體用法?TypeScript RouteParams怎麽用?TypeScript RouteParams使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: constructor

 constructor(routeParams:RouteParams, private pictureservice:PictureService) {
   this.id = routeParams.get('id');
 }
開發者ID:hollannikas,項目名稱:ssoidh-angular2,代碼行數:3,代碼來源:picture.component.ts

示例2: constructor

 constructor(private _service:BooksService,
             private _router:Router,
             routeParams:RouteParams) {
     this._selectedId = +routeParams.get('id');
 }
開發者ID:PawelPisarek,項目名稱:DTTA_KSIEGARNIA,代碼行數:5,代碼來源:borrow-list.component.ts

示例3: constructor

 constructor(
   private _questionnaireService:QuestionnaireService,
   routeParams:RouteParams) {
   this._id = routeParams.get('id');
 }
開發者ID:panrenliang,項目名稱:ng2book-part3-demo,代碼行數:5,代碼來源:published.ts

示例4: ngOnInit

 ngOnInit() {
   // Notice how we extract the id by calling the RouteParams.get method.
   let id = +this._routeParams.get('id'); // The hero id is a number. Route parameters are always strings. So we convert the route parameter value to a number with the JavaScript (+) operator.
   this._heroService.getHero(id)
     .then(hero => this.hero = hero);
 }
開發者ID:irstacks,項目名稱:angular2-heroes,代碼行數:6,代碼來源:hero-detail.component.ts

示例5: constructor

 constructor(params: RouteParams, phones: Phones) {
     phones.getPhone({ phoneId: params.get("phoneId") }).then((phone) => {
         this.phone = phone;
         this.mainImageUrl = phone.images[0];
     });
 }
開發者ID:rushi216,項目名稱:angular-migration,代碼行數:6,代碼來源:phoneDetail.component.ts

示例6: ngOnInit

 ngOnInit():any {
     let itemIndex = this._routerParams.get('recipeIndex');
     this._recipeIndex = itemIndex;
     this.recipe = this._recipeService.getRecipe(+itemIndex) || null;
 }
開發者ID:Feling,項目名稱:RecipeBook,代碼行數:5,代碼來源:recipe-detail.component.ts

示例7:

 _dataService.events$.map(events => events.find(event => event.id === _params.get('id')));
開發者ID:Brocco,項目名稱:houston,代碼行數:1,代碼來源:event-edit.ts

示例8: ngOnInit

 ngOnInit() {
   // convert the route parameter value to a number with the JavaScript (+) operator.
   let id = +this._routeParams.get('id');
   this._heroService.getHero(id)
     .then(hero => this.hero = hero);
 }
開發者ID:DermotMurphy,項目名稱:angular2-tour-of-heroes,代碼行數:6,代碼來源:hero-detail.component.ts

示例9: ngOnInit

 ngOnInit() {
     let id = +this.routeParams.get('id');
     this.postService.getPost(id)
         .subscribe(post => this.post = post);
 }
開發者ID:herasimau,項目名稱:blog-app,代碼行數:5,代碼來源:post-detail.component.ts

示例10: ngOnInit

 ngOnInit():any {
     this.newSoldier = {name: this._routeParams.get('name'), power: null, health: null};
 }
開發者ID:weicheng2138,項目名稱:angular2-practice,代碼行數:3,代碼來源:new-soldier.component.ts


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