when I try to import a directive from another file, I get an error like EXCEPTION: No Directive annotation found on MyComponent - how to solve this?
here is my code:
app.component.ts:
import {Component} from 'angular2/core'; import {MyComponent} from "./app.my-component" @Component({ selector: 'app', template: ` <h1>Hellow World</h1> <span>Here is your component:</span> <my-component></my-component> `, directives: [MyComponent] }) export class AppComponent { }
app.mycomponent.ts:
import {Component} from 'angular2/core'; @Component({ selector : 'my-component', template : `<h2>This is from My component</h2>` }); export class MyComponent { };
But I get an error like: No Directive annotation found on MyComponent how to solve this?
source share