Every time I attempt to load my angular version 2.0 application, I encounter the following error: (index):21 Error: Error: Unexpected value '[object Object]' imported by the module 'AppModule'
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { searchComponent } from './search.Component';
import { landingComponent } from './landing.Component';
export const routes: Routes = [
{
path: '',
component: searchComponent
},
{
path: 'search',
component: searchComponent
}];
export const routedComponents = [searchComponent, landingComponent];
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);
AppModule
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { landingComponent } from './landing.Component';
import { searchComponent } from './search.Component';
import { routes, routedComponents } from './app.routing';
import { homeScript } from './Services/homeScript';
@NgModule({
imports: [
BrowserModule,
FormsModule,
HttpModule,
routes
],
declarations: [
landingComponent,
searchComponent,
routedComponents
],
providers: [
homeScript
],
bootstrap: [landingComponent]
})
export class AppModule { }
Type script for booting
///<reference path="./../typings/globals/core-js/index.d.ts"/>
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './appModule';
platformBrowserDynamic().bootstrapModule(AppModule)
.then(success => console.log(`Bootstrap success`))
.catch(error => console.log('GUY ' + error));
If I exclude 'routes' from the imports, the landing page loads without any errors. My suspicion lies within the routing, as omitting 'routes' in the AppModule allows the landing page to load correctly. Despite several attempts, I have been unable to pinpoint the root of the issue. Any assistance on this matter would be greatly appreciated.