2016-10-05 24 views
0

デフォルトのコンポーネントを動作していないです。コンポーネントは、角度JSで2

import {Component} from 'angular2/core'; 
import {MyComponentComponent} from './mycomponentcomponent'; 

@Component({ 
    selector: 'my-app', 
    template: ` 
     <h1>Angular 2 Demo</h1> 
     <p>Hello World Testing</p> 
     <test-app></test-app> 

    `, 
    directories:[MyComponentComponent] 
}) 
export class AppComponent { 

} 

第二成分:

import {Component} from 'angular2/core'; 

@Component({ 
    selector: 'test-app', 
    template: ' 
     <h1>TEST APP</h1> 
     <p>TEST APP -> Hello World Testing 12</p> 
    ', 
}) 
export class MyComponentComponent { 

} 

しかし、それはjavascriptのエラーを示しています。私は間違いをどこでしているのか分かりますか?

Angular2の新しいバージョンについては
directives:[MyComponentComponent] 


+0

それを追加してくださいあなたの質問に。 –

+0

'ディレクトリ'は 'directives'でなければなりません、あなたは古いバージョンのangular2を使っていますね、それを最後にAngular 2にアップグレードしてください –

+0

どのバージョンをお使いですか? – micronyks

答えて

関連する問題