首页 文章

Angular 2错误指令

提问于
浏览
0

我可以使用一些帮助,我正在学习ANGULAR 2路由,我收到此错误:

app / app.component.ts(7,12):错误TS2345:类型'{selector:string; templateUrl:string;指令:( typeof PeliculasListComponent | typeof Peli ...'不能分配给'{selector?:string;输入?:string [];输出?:string [];属性?:string []; events?: strin ...' . 属性'指令'的类型是不兼容的 . 类型'(typeof PeliculasListComponent | typeof PeliculasFooterComponent | typeof“C:/ UwAmp / www / curso-ang ...”不能分配给''类型'| [])[]' . 输入'typeof PeliculasListComponent | typeof PeliculasFooterComponent | typeof“C:/ UwAmp / www / curso-angu ...”不能分配给'Type | any []'类型 . 输入'typeof'C: /UwAmp/www/curso-angular/app/components/contacto.component“'不能分配给'Type | any []' . 输入'typeof”C:/ UwAmp / www / curso-angular / app / components / contacto.component“'不能赋值为'any []' . 类型'typeof”C:/UwAmp/www/curso-angular/app/components/contacto.component“'中缺少属性'length' . app / app.component.ts(16,14):error TS2345:类型'的参数({path:string; name:string; component: typeof PeliculasListComponent; useAsDefault:boolean; } ...'不能分配给'RouteDefinition []'类型的参数 . 输入'{path:string; name:string; component:typeof PeliculasListComponent; useAsDefault:boolean; } ...'不能赋值为'RouteDefinition' . 输入'{path:string; name:string; component:typeof“C:/ UwAmp / www / curso-angular / app / components / contac ...”不能分配给'RouteDefinition'类型 . 属性'component'的类型是不兼容的 . 输入'typeof'C:/ UwAmp /www/curso-angular/app/components/contacto.component“'不能分配给'Type | ComponentDefinition'类型 . 输入'typeof”C:/UwAmp/www/curso-angular/app/components/contacto.component“ '不能赋值为'ComponentDefinition' . 类型'typeof“C:/UwAmp/www/curso-angular/app/components/contacto.component”'中缺少属性'type' .

这是我的代码:

import {Component} from "angular2/core";
import {PeliculasListComponent} from "./components/peliculas-list.component";
import {PeliculasFooterComponent} from "./components/peliculas-footer.component";
import ContactoComponent from "./components/contacto.component";

import {ROUTER_DIRECTIVES, RouteConfig, Router} from "angular2/router";
@Component({
    selector: "my-app",
    templateUrl: "app/views/peliculas.html",
    directives: [PeliculasListComponent,
                 PeliculasFooterComponent,
                 ContactoComponent, 
                 ROUTER_DIRECTIVES]
})

@RouteConfig([
    {path: "/peliculas", name:"Peliculas", component: PeliculasListComponent, useAsDefault: true},
    {path: "/contacto", name:"Contacto", component: ContactoComponent}*/
])

export class AppComponent{
    public titulo:string = "Peliculas con angular" ;

}

你有什么想法如何解决它?谢谢!!

1 回答

相关问题