I'm trying to pass input parameters to a component but I'm getting this exception: browser_adapter.ts:78 EXCEPTION: Error: Uncaught (in promise): No Directive annotation found on PropDecoratorFactory
I tried the solutions described here and it didn't solve the issue for me:
Here is my code:
import {Component, provide, Input} from '@angular/core';
import {bootstrap} from '@angular/platform-browser-dynamic';
import {Http, HTTP_PROVIDERS} from '@angular/http';
import {RouteConfig, ROUTER_DIRECTIVES, Router, ROUTER_PROVIDERS} from '@angular/router-deprecated'
@Component({
selector: 'sub',
template : `<p>input: {{someInput}}</p>`,
directives: [Input]
})
export class SubComponent {
@Input() someInput: Number;
}
@Component({
selector: 'home',
template : `<p>home</p><sub [someInput]="someInput"></sub>`,
directives: [SubComponent]
})
export class HomeComponent {
someInput: Number = 123;
}
@Component({
selector: 'my-app',
template: '<h1>here!</h1><router-outlet></router-outlet>',
directives: [ROUTER_DIRECTIVES],
providers: [ROUTER_PROVIDERS]
})
@RouteConfig([
{ path: '/home', name: "Home", component: HomeComponent, useAsDefault: true}
])
export class App {
}
and my Plunker: http://plnkr.co/edit/wNKmsnjHf6HeCQD1gV8c?p=preview