Scully: Route Traversal with Class helpers

Created on 26 May 2020  路  3Comments  路  Source: scullyio/scully

馃悶 Bug report

Description

Okay we all hate boilerplate. It sucks. AutoComplete and Hints help a ton! But what happens when that is STILL more typing to get the right Intellisense instead of just using a helper class to construct an object for you that meets the requirements of the route object?

馃敩 Minimal Reproduction

  1. Make a new Angular CLI app and add some routes
  2. Add Scully
  3. Modify the routing module like so:
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AComponent } from './a/a.component';
import { BComponent } from './b/b.component';

class Route {
  constructor(public path: string, public component: any) {}
}

const routes: Routes = [
  new Route('', AComponent),
  new Route('b', BComponent),
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
  1. Build and Serve with Scully

It will work in Angular with ng serve, but with Scully it will not work on any pages except the home route.

馃捇Your Environment

Angular Version:




Angular CLI: 9.1.4
Node: 12.13.0
OS: win32 x64

Angular: 9.1.4
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.4
@angular-devkit/build-angular     0.901.4
@angular-devkit/build-optimizer   0.901.4
@angular-devkit/build-webpack     0.901.4
@angular-devkit/core              9.1.4
@angular-devkit/schematics        9.1.4
@angular/cdk                      9.2.4
@ngtools/webpack                  9.1.4
@schematics/angular               9.1.4
@schematics/update                0.901.4
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

Scully Version:





馃敟 Exception or Error

There is only one outputted route:

[{"route":"/"}]
bug

All 3 comments

Just curious, what happens when you set up your b route like

new Route('b', BComponent) ?

whoops that is how I set it up. Sorry, it's a little late for me. Fat fingered and slow-minded.

@skatcat31 This is an issue with Guess-parser. Scully is depending on that for route traversal.
There is no actionable content for Scully here, so I'm closing this issue for now.
If you have more insights, please add them here, and we can reopen.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

montella1507 picture montella1507  路  5Comments

nishimura-yuji picture nishimura-yuji  路  4Comments

jorgeucano picture jorgeucano  路  4Comments

puku0x picture puku0x  路  4Comments

ghost picture ghost  路  4Comments