Closed. This question needs details or clarity。它当前不接受答案。
                            
                        
                    
                
            
                    
                
                        
                            
                        
                    
                        
                            想改善这个问题吗?添加详细信息并通过editing this post阐明问题。
                        
                        2年前关闭。
                    
                
        

通过[routerLink]进行查看或查看完整的信息:

error_handler.js:54例外:未捕获(已承诺):错误:无法匹配任何路由。网址段:“ usuario-cadastrar-dialog”
错误:无法匹配任何路线。网址段:“ usuario-cadastrar-dialog”

PáginaHTML:

<h1>Usuários</h1>

<button type="button" *ngIf="mostrarBotaoNovo"
    [routerLink]="['/', { outlets: { popup: ['usuario-cadastrar-dialog'] }
}]"
    class="btn btn-default">
   <i class="fa fa-user" aria-hidden="true"></i> Novo usuário
</button>


usuario-routing.ts

import {NgModule} from "@angular/core";
import {RouterModule} from "@angular/router";
import {GerenciarUsuarioComponent} from "./usuario-gerenciar/usuario-gerenciar.component";
import {CadastrarEditarUsuarioDialogComponent} from "./usuario-cadastrar-dialog/usuario-cadastrar-dialog.component";

@NgModule({
  imports: [
    RouterModule.forChild([
      {
        path: 'administracao',
        children: [
          {path: 'usuario', component: GerenciarUsuarioComponent},
          {path: 'usuario-cadastrar-dialog', component: CadastrarEditarUsuarioDialogComponent, outlet: 'popup'}
        ]
      }
    ])
  ],
  exports: [RouterModule]
})
export class UsuarioRouting {
}


app-routing.module.ts

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {PrincipalComponent} from "./principal/principal.component";
import {UsuarioRouting} from "./usuario/usuario-routing";

const routes: Routes = [
  {
    path: '',
    pathMatch: 'full',
    component: PrincipalComponent
  },

  ...UsuarioRouting
];

@NgModule({
  imports: [RouterModule.forRoot(routes, {useHash: true})],
  exports: [RouterModule],
  providers: []
})
export class AppRoutingModule { }

最佳答案

使用者介面,使用者介面,使用者介面,使用者介面,使用者介面,使用者介面,使用者介面,使用者介面,使用者介面,使用者介面,使用者介面等。

滕塔手印

[routerLink]="['/', { outlets: { popup: ['usuario-cadastrar-dialog'] }


pra isso:

[routerLink]="['/', { outlets: { popup: ['administracao/usuario-cadastrar-dialog'] }.


Ou apenas colocar uma rota no seu componente负责人,aqui:

const routes: Routes = [
{
path: '',
   pathMatch: 'full',
   component: PrincipalComponent,
 path: 'usuario-cadastrar-dialog',
    pathMatch: 'full',
    component: CadastrarEditarUsuarioDialogComponent
},


(不要再输入CadastrarEditarUsuarioDialogComponent)。

关于javascript - 未捕获( promise ):错误:无法匹配任何路由。网址段:,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43459030/

10-09 19:29