Skip to content

[BUG] Route parsing error #216

Closed
Closed

Description

@Stalyon
Overview of the issue

I have the following issue:

[08:45:30] parsing : D:/xxx/xxx-xx-routing.module.ts
[08:45:30] Routes parsing error, maybe a trailing comma or an external variable, trying to fix that later after sources scanning.

My routing module is:

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AuthGuardService } from '../common/services/auth-guard.service';
import { AComponent} from './a.component';
import { Role } from '../common/model/enum/role.enum';

const routes: Routes = [
    {
        path: 'a-path',
        component: AComponent,
        data: { requiresLoggedIn: true, requiresRole: [ Role.ROLE_XXX ] },
        canActivate: [ AuthGuardService ]
    }
];

@NgModule({
    imports: [
        RouterModule.forChild(routes)
    ],
    exports: [
        RouterModule
    ]
})
export class XXXRoutingModule { }

And my command in package.json is:

"compodoc": "./node_modules/.bin/compodoc -p src/tsconfig.app.json -n 'Documentation-Angular' --theme readthedocs -s

The issue is not a comma.
The problem seems to be there:

        data: { requiresLoggedIn: true, requiresRole: [ Role.ROLE_XXX ] },
        canActivate: [ AuthGuardService ]

When I remove this part of code, there is no problem.

What could be the solution ?

Compodoc installed globally or locally ?

locally

Versions

compodoc: 1.0.0-beta.10
npm: 5.0.4
node: 8.0.0
Windows 10

Activity

  1. changed the title [-][BUG ]Route parsing error[/-] [+][BUG] Route parsing error[/+] on Jul 5, 2017
  2. vogloblinsky commented on Jul 5, 2017

    @vogloblinsky
    Contributor

    Related to #51

    I have to enhance the routes parsing with external variable support.

  3. added this to the 1.0.0-beta.14 milestone on Jul 12, 2017
  4. modified the milestones: , 1.0.0-beta.15 on Aug 20, 2017
  5. modified the milestones: 1.0.2, 1.0.1 on Sep 7, 2017
  6. tomaszwawrzyniakit commented on Sep 22, 2017

    @tomaszwawrzyniakit

    Not work for me.

    const APP_ROUTES: Routes = [
     {
        path: 'app',
        children: [
          {
            path: 'example',
            component: ExampleComponent
          }
        ]
      },
      {
        path: '',
        redirectTo: '/app/example',
        pathMatch: 'full'
      },
      {
        path: '**',
        redirectTo: '/app/example'
      }
    ];
    

    Compodoc installed globally or locally ?
    locally

    Versions

    compodoc: 1.0.2
    node: 6.0.88
    Windows 7

  7. modified the milestones: 1.0.2, 1.2.0 on Oct 8, 2017
  8. modified the milestones: 1.2.0, 1.0.5 on Nov 10, 2017
  9. vogloblinsky commented on Nov 17, 2017

    @vogloblinsky
    Contributor

    Bug fixed for dynamic path and pathMatch for route definition.
    Need to work on other parts of route description : https://angular.io/api/router/Routes#description

  10. Gruwa commented on Mar 13, 2018

    @Gruwa

    Same problem

    following issue:

    [01:28:22] found          : AppComponent
    [01:28:22] parsing        : /Users/aleks/Projects/mentarea-front/src/app/app.module.ts
    [01:28:22] Analysing routes definitions and clean them if necessary
    [01:28:22] Routes parsing error, maybe a trailing comma or an external variable, trying to fix that later after sources scanning.
    Unhandled Rejection at: Promise {
      <rejected> TypeError: Cannot read property 'kind' of undefined ....
    

    routing module is:

    const appRoutes: Routes = [
      {
        path: 'calendar',
        component: CalendarComponent
      },
      {
        path: 'auth',
        component: LoginComponent
      },
      {
        path: '',
        redirectTo: 'auth',
        pathMatch: 'full'
      },
      {
        path: '**',
        redirectTo: 'auth'
      }
    ];
    
    

    Compodoc installed globally or locally ?
    locally

    Versions

    compodoc: 1.0.9
    node: 8.9.4
    Mac OS X version 10.11.6

  11. gangfang commented on Apr 2, 2018

    @gangfang

    @Gruwa Please update compodoc from 1.0.9 to 1.1.1 (latest).

    Just tried it, the problem is resolved.

  12. lock commented on Sep 30, 2019

    @lock

    This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. Why locking ? Having issues with the most up-to-date context.

  13. locked as resolved and limited conversation to collaborators on Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions