Closed
Labels
P5The team acknowledges the request but does not plan to address it, it remains open for discussioneffort2: medium (days)featureLabel used to distinguish feature request from other issues
Description
Bug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@angular/cli: 1.1.3
node: 6.9.1
os: darwin x64
@angular/animations: 4.2.4
@angular/common: 4.2.4
@angular/compiler: 4.2.4
@angular/core: 4.2.4
@angular/flex-layout: 2.0.0-beta.8
@angular/forms: 4.2.4
@angular/http: 4.2.4
@angular/material: 2.0.0-beta.6
@angular/platform-browser: 4.2.4
@angular/platform-browser-dynamic: 4.2.4
@angular/router: 4.2.4
@angular/cli: 1.1.3
@angular/compiler-cli: 4.2.4
Repro steps.
We have a routes class which holds all the static routes strings to be used in routes configuration of angular and in all the router links:
export class RoutesPathRegistry {
static foo = '';
static bar = 'link';
}Using this link in the routes setup breaks the AOT compilation with angular CLI:
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { RoutesPathRegistry } from 'app/modules/routes';
import { FooComponent } from './components/foo.component';
import { BarComponent } from './components/bar.component';
const appRoutes: Routes = [
{
path: RoutesPathRegistry.bar,
component: BarComponent
},
{
path: RoutesPathRegistry.foo,
component: FooComponent,
pathMatch: 'full'
}
];
@NgModule({
imports: [
RouterModule.forRoot(appRoutes)
],
exports: [
RouterModule
]
})
export class AppRoutingModule {}The log given by the failure.
ERROR in Illegal state: symbol without members expected, but got {"filePath":"****/src/app/modules/routes/path-registry.ts","name":"RoutesPathRegistry","members":["foo"]}.
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '****/src'
@ ./src/main.ts 3:0-74
@ multi ./src/main.ts
Desired functionality.
Successful AOT compilation
Metadata
Metadata
Assignees
Labels
P5The team acknowledges the request but does not plan to address it, it remains open for discussioneffort2: medium (days)featureLabel used to distinguish feature request from other issues
Activity
filipesilva commentedon Jun 26, 2017
This isn't something we support currently, but might in the future.
andreasrueedlinger commentedon Jun 26, 2017
@filipesilva please note that it is not the indirection that is the problem but the empty string. All the other indirect routes paths (like bar in the example above) do not cause any problem and work as expected. Hence I don't see the link to #6784
krishnanmk commentedon Jun 27, 2017
Thanks @filipesilva . Can you please suggest me an alternative to pull this off?
I have seen some articles on adding routes dynamically and replacing them using
router.resetConfig(). It seems to work, for top-level routes (app-routing.module level), but can't find a way to do this for child routes, i.e. routes in a child module, esp. lazy loaded ones.Any tip would be of great help.! (This is in reference to #6784.)
filipesilva commentedon Jun 28, 2017
@andreasbhansen you're right, I think I misread these two issues. Given that other routes work, this might be a problem with
ngcitself. Could you open an issue in https://github.com/angular/angular instead please?@kichnan I'll reopen and answer your issue there.
andreasrueedlinger commentedon Jun 28, 2017
@filipesilva thanks, since I did not know where the problem was I opened an issue in both places. Here is the corrsponding issue:
angular/angular#17728
andreasbhansen commentedon Jun 28, 2017
I think you tagged the wrong Andreas, @filipesilva :)
filipesilva commentedon Jun 28, 2017
@andreasrueedlinger my bad, sorry about that :E
angular-automatic-lock-bot commentedon Sep 7, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.