2016-08-04 38 views
0

私はhttps://angular.io/docs/ts/latest/guide/upgrade.htmlステップ、すなわち「角度1のコードからの角度2のコンポーネントを使用する」の部分に従います。角度1のアプリケーションで角度2のコンポーネントを使用

次のコードを持つ英雄-detail.component.ts作成しました:main.tsに必要なコードを追加した後

import { Component } from '@angular/core'; 
@Component({ 
    selector: 'hero-detail', 
    template: ` 
    <h2>Windstorm details!</h2> 
    <div><label>id: </label>1</div> 
    ` 
}) 
export class HeroDetailComponent { 
} 

を:

import { upgradeAdapter } from './upgrade-adapter'; //this existed already 
import { HeroDetailComponent } from './hero-detail.component'; //added 

//... here other code inbetween 

angular.module('heroApp', []) 
    .directive('heroDetail', upgradeAdapter.downgradeNg2Component(HeroDetailComponent)); 

今、私は私のhtmlで<hero-detail></hero-detail>を挿入しますが、ご覧ください何もない。何が欠けている?

答えて

0

main.tsではなく、app.tsにコードの指示部分が追加されているはずです。

関連する問題