-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Milestone
Description
Versions
Angular CLI: 1.6.1
Node: 8.9.0
OS: darwin x64
Angular: 5.1.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
@angular/cli: 1.6.1
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.1
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.10.0
Repro steps
- Follow the steps to add an app shell to angular universal app as described here
- Create a 'not-found' component with the following angular-cli command:
ng generate component not-found --skip-import
- Import and add the NotFoundComponent to
app-routing.module.ts
:
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { NotFoundComponent } from './not-found/not-found.component';
const routes: Routes = [
{ path: '**', component: NotFoundComponent }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
- Import and add NotFoundComponent to declarations array in
app.module.ts
- Run
ng build --prod
- Inspect
dist/index.html
Observed behavior
dist/index.html
includes the <app-not-found>
tag for the NotFoundComponent. See the snippet below:
<router-outlet _ngcontent-c0=""></router-outlet><app-not-found _nghost-c1=""><p _ngcontent-c1="">
not-found works!
</p>
</app-not-found>
Desired behavior
dist/index.html
should include the <app-app-shell>
tag for the AppShellComponent. See the snippet below:
<router-outlet _ngcontent-c0=""></router-outlet><app-app-shell _nghost-c1=""><p _ngcontent-c1="">
app-shell works!
</p>
</app-app-shell>
Mention any other details that might be useful (optional)
Based on the documentation I could find about the App Shell feature introduced in Angular 5.1 (see here & here), I could not find anything detailing how the app shell should work when a wildcard route (aka 'not found' page) is present in an app's routing config.
How should an app with a wildcard route be configured to support an app-shell and its accompanying route?
sam-n-eric, jaa1982, cvgaviao, d-nation, Manduro and 12 more