Angular2 Router error: cannot find primary outlet to load 'HomePage'

后端 未结 4 1581
孤城傲影
孤城傲影 2020-12-03 00:38

I just started using the new routing library (@angular/router v3.0.0-alpha.7) but following the official docs leads to error below:

browser_adapter.ts:74: EX         


        
4条回答
  •  孤城傲影
    2020-12-03 00:48

    You have an error in your app.component.ts Looks like you declared a directive in the providers array.

    import { Component } from '@angular/core';
    import { ROUTER_DIRECTIVES } from '@angular/router';
    
    @Component({
        selector: 'app',
        template: `
            

    Angular 2 is running...

    `, directives: [ROUTER_DIRECTIVES] //here }) export class AppComponent { }

提交回复
热议问题