Angular 2 Router error, Route config should contain exactly one “component”, “loader”, or “redirectTo” property

后端 未结 8 1784
南笙
南笙 2021-01-18 05:35

This is my setup:

import {bootstrap} from \'angular2/platform/browser\';
import {Component} from \'angular2/core\';
import {LocationStrategy, APP_BASE_HREF,          


        
8条回答
  •  一生所求
    2021-01-18 06:17

    In my case the problem was incorrectly imported child component. The component export was default:

    export default class HomeComponent {}
    

    So i replaced its import from

    import { HomeComponent } from './homeComponent';
    

    to

    import HomeComponent from './homeComponent';
    

    and it works!

    Interesting that webpack which i use to bundle the app does not provide any errors/warnings.

提交回复
热议问题