Hey there, I'm currently working on understanding ANGULAR 2 routing, but I've encountered an error that's causing some trouble. Here's the issue I'm facing:
app/app.component.ts(7,12): error TS2345: Argument of type '{ selector: string; templateUrl: string; directives: (typeof PeliculasListComponent | typeof Peli...' is not assignable to parameter of type '{ selector?: string; inputs?: string[]; outputs?: string[]; properties?: string[]; events?: strin...'. Types of property 'directives' are incompatible. Type '(typeof PeliculasListComponent | typeof PeliculasFooterComponent | typeof "C:/UwAmp/www/curso-ang...' is not assignable to type '(Type | any[])[]'. Type 'typeof PeliculasListComponent | typeof PeliculasFooterComponent | typeof "C:/UwAmp/www/curso-angu...' is not assignable to type 'Type | any[]'. Type 'typeof "C:/UwAmp/www/curso-angular/app/components/contacto.component"' is not assignable to type 'Type | any[]'. Type 'typeof "C:/UwAmp/www/curso-angular/app/components/contacto.component"' is not assignable to type 'any[]'. Property 'length' is missing in type 'typeof "C:/UwAmp/www/curso-angular/app/components/contacto.component"'. app/app.component.ts(16,14): error TS2345: Argument of type '({ path: string; name: string; component: typeof PeliculasListComponent; useAsDefault: boolean; }...' is not assignable to parameter of type 'RouteDefinition[]'. Type '{ path: string; name: string; component: typeof PeliculasListComponent; useAsDefault: boolean; } ...' is not assignable to type 'RouteDefinition'. Type '{ path: string; name: string; component: typeof "C:/UwAmp/www/curso-angular/app/components/contac...' is not assignable to type 'RouteDefinition'. Types of property 'component' are incompatible. Type 'typeof "C:/UwAmp/www/curso-angular/app/components/contacto.component"' is not assignable to type 'Type | ComponentDefinition'. Type 'typeof "C:/UwAmp/www/curso-angular/app/components/contacto.component"' is not assignable to type 'ComponentDefinition'. Property 'type' is missing in type 'typeof "C:/UwAmp/www/curso-angular/app/components/contacto.component"'.
I've pasted my code below:
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" ;
}
If you have any suggestions on how to resolve this error, please let me know. Thanks a ton!