guide - Angular2 versión RC.6 "directivas" dentro de @Component Error
ng-href angular 6 (2)
sencillo...
El problema es con las directives: ''''
como es una matriz debe ser directives: [ ]
Actualización : En RC6 o una versión posterior, tienes @NgModule
. En la versión RC6 o posterior, debe declarar las pipes
y las directives
que va a utilizar dentro de @NgModule
como se muestra ...
import { PeopleListComponent } from ''./people-list/people-list.component'';
@NgModule({
imports: [ BrowserModule],
declarations: [ AppComponent,PeopleListComponent ], //<<===here
providers: [],
bootstrap: [ AppComponent ]
})
Puede eliminar directives:''''
desde @Component
de AppComponent
Estoy usando Angular2 y descargué package.json del sitio web oficial. Cuando intento utilizar "directivas" dentro de @Component decorator, aparece este error.
He adjuntado mi código ERROR:
[ts]
Argument of type ''{ selector: string; template: string; directives: string;
}'' is not assignable to parameter of type ''ComponentMetadataType''.
Object literal may only specific known properties, and ''directives'' does not
exist in type ''ComponentMetadataType''.
(property) directives: string
Este es mi código:
import { Component } from ''@angular/core'';
import { PeopleListComponent } from ''./people-list/people-list.component'';
@Component({
selector: ''my-app'',
template: ''<h1>{{ title }}</h1>'',
directives: '''' //ERROR //NOT ABLE TO RECOGNIZE
})
export class AppComponent {
title = "My title";
}
Aquí está mi package.json:
{
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"start": "tsc && concurrently /"npm run tsc:w/" /"npm run lite/" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0-rc.6",
"@angular/compiler": "2.0.0-rc.6",
"@angular/compiler-cli": "0.6.0",
"@angular/core": "2.0.0-rc.6",
"@angular/forms": "2.0.0-rc.6",
"@angular/http": "2.0.0-rc.6",
"@angular/platform-browser": "2.0.0-rc.6",
"@angular/platform-browser-dynamic": "2.0.0-rc.6",
"@angular/router": "3.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.6",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.11",
"systemjs": "0.19.27",
"zone.js": "^0.6.17",
"angular2-in-memory-web-api": "0.0.18",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"concurrently": "^2.2.0",
"lite-server": "^2.2.2",
"typescript": "^1.8.10",
"typings":"^1.3.2"
}
}
directives
y las pipes
dentro de @Component
están en desuso de RC6 angular. Verifique mi respuesta en https://.com/questions/39410417/how-to-import-component-into-another-root-component-in-angular-2