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

后端 未结 8 1788
南笙
南笙 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:16

    Your NgModule should be changed from

    provide(LocationStrategy, {useClass: HashLocationStrategy})
        , provide(APP_BASE_HREF, {useValue: '/'})]);
    

    To

    providers: [LocationStrategy, {useClass: HashLocationStrategy}), {provide: APP_BASE_HREF, useValue: '/'}]
    

    https://github.com/angular/angular/issues/12295

提交回复
热议问题