Angular2のチュートリアル「tour-of-heroes」のソースコードで質問です。
angular2-tour-of-heroes/app/hero-detail.component.ts
このソースコードは下になります。
Typescriptで書かれています。
import { Component, Input, OnInit } from 'angular2/core'; import { RouteParams } from 'angular2/router'; import { Hero } from './hero'; import { HeroService } from './hero.service'; @Component({ selector: 'my-hero-detail', templateUrl: 'app/hero-detail.component.html', styleUrls: ['app/hero-detail.component.css'] }) export class HeroDetailComponent implements OnInit { @Input() hero: Hero; constructor( private _heroService: HeroService, private _routeParams: RouteParams) { } ngOnInit() { let id = +this._routeParams.get('id'); this._heroService.getHero(id) .then(hero => this.hero = hero); } goBack() { window.history.back(); } }
このngOnInit(){}の中身の
let id = +this._routeParams.get('id');
の部分の+thisの「+」の意味がわかりません。どなたか意味を教えてください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2016/08/08 11:48