相关疑难解决方法(0)

rxjs:EmptyError:序列中没有元素

我收到了一个错误

当我转到localhost:8080时,'EmptyError:序列中没有元素'错误.

我看到了线程Angular 5 EmptyError:在制作子路由时没有顺序的元素,但似乎没有任何答案适用.

我有"rxjs": "^5.5.6",在我的路线中,我尝试添加,pathMatch: 'full',但仍然显示错误.

我的app-routing-module.ts的摘录

const routes: Routes = [
    {
        pathMatch: 'full', /* added recently for test purposes*/
        path: '',
        component: RootComponent,
        canActivate: [AuthGuard],
        children: [
            {
                pathMatch: 'full', /* added recently for test purposes*/
                path: '',
                component: RootLoggedComponent
            },
Run Code Online (Sandbox Code Playgroud)

这只发生在最近,我添加了一个http拦截器:

export class myInterceptor implements HttpInterceptor {
    constructor(
        private router: Router
    ) {

    }

    intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {

        return next.handle(request)
            .pipe(catchError(err => {
                if (err …
Run Code Online (Sandbox Code Playgroud)

rxjs angular angular6

8
推荐指数
1
解决办法
2480
查看次数

Angular 2.0.1路由器EmptyError:顺序没有元素

我无法使Angular 2路由工作.我正在使用Angular 2和Webpack.在Angular 2 webpack启动器中,我注意到他们有webpack生成他们的html和他们的链接,但我希望我不必webpack我的html文件.

这是我的app.routes.ts ...

import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { HomeComponent } from "./home/home.component";
import { ScheduleComponent } from "./schedule/schedule.component";
import { PageNotFoundComponent } from "./PageNotFoundComponent";

const appRoutes: Routes = [
    { path: '', component: HomeComponent },
    { path: 'schedule', component: ScheduleComponent },
    { path: '**', component: PageNotFoundComponent }
];

export const appRoutingProviders: any[] = [

];

export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
Run Code Online (Sandbox Code Playgroud)

这是我的@NgModule代码......

@NgModule({
    imports: [
        BrowserModule, …
Run Code Online (Sandbox Code Playgroud)

angular-routing webpack angular

5
推荐指数
1
解决办法
3954
查看次数

标签 统计

angular ×2

angular-routing ×1

angular6 ×1

rxjs ×1

webpack ×1