angular - Angular2 RC1No Directive annotation found on PropDecoratorFactory with @Input -
i'm trying pass input parameters component i'm getting exception: browser_adapter.ts:78 exception: error: uncaught (in promise): no directive annotation found on propdecoratorfactory
i tried solutions described here , didn't solve issue me:
here code:
import {component, provide, input} '@angular/core'; import {bootstrap} '@angular/platform-browser-dynamic'; import {http, http_providers} '@angular/http'; import {routeconfig, router_directives, router, router_providers} '@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 plunker: http://plnkr.co/edit/wnkmsnjhf6hecqd1gv8c?p=preview
remove input
directives
array line
@component({ selector: 'sub', template : `<p>input: {{someinput}}</p>`, directives: [input] // <---- causing }) export class subcomponent { @input() someinput: number; }
input not directive, decorator component inputs used inside class, not on html.
Comments
Post a Comment