when i trying to import a directive from other file, i am getting the error as 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 am getting error as : No Directive annotation found on MyComponent
how to solve this?
You should remove ;
after component closing Component
directive parenthesis.
import {Component} from 'angular2/core';
@Component({
selector : 'my-component',
template : `<h2>This is from My component</h2>`
})
export class MyComponent { };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With