Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 找不到要加载组件的命名出口_Angular_Angular2 Routing - Fatal编程技术网

Angular 找不到要加载组件的命名出口

Angular 找不到要加载组件的命名出口,angular,angular2-routing,Angular,Angular2 Routing,//编辑2:从Angular 4开始,这似乎已被修复/修改。目前,我能够在未命名插座的“内部”定义命名插座 //编辑: 正如@Michelangelo所指出的,这似乎是一个与角度路由器相关的“设计选择”。作为一种解决方法,我正在使用当前用户将user-edit.component动态注入用户列表中。 请参阅,以了解有关这方面的更多信息 我有以下设置: { path: 'admin', canActivate: [ AuthGuard, PermissionGua

//编辑2:从Angular 4开始,这似乎已被修复/修改。目前,我能够在未命名插座的“内部”定义命名插座

//编辑: 正如@Michelangelo所指出的,这似乎是一个与角度路由器相关的“设计选择”。作为一种解决方法,我正在使用当前用户将user-edit.component动态注入用户列表中。
请参阅,以了解有关这方面的更多信息


我有以下设置:

{
        path: 'admin',
        canActivate: [ AuthGuard, PermissionGuard ],
        children: [ 
            { 
                path: '', 
                component: UserListComponent,
                resolve: {
                    users: UsersResolver
                }
            },
            {
                path: ':id',
                component: UserEditComponent,
                outlet: 'admin'
            }
        ]
    }
插座看起来像:

<router-outlet name="admin"></router-outlet>
如果我尝试在不指定出口的情况下导航到该路线,则效果良好。但当我尝试使用一个命名的路由器插座时,它就坏了

Error: Cannot find the outlet admin to load 'UserEditComponent'

好吧,这不是你问题的答案,但我也面临同样的问题 由于这个问题,我最终没有选择指定的门店。如果你在网上搜索,你不是唯一一个有这个问题的人

看起来AngularJS 2的路由仍然需要修复在AngularJS 1.x中正常工作的基本内容


我所做的是根据当前路径显示和隐藏应用程序中的元素,请参见我的回答:

“[…]需要一个突破性的更改。”解决方法可能会破坏我现有的代码。。无所谓,谢谢分享你的方法!
Error: Cannot find the outlet admin to load 'UserEditComponent'