Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

AngularClass/resolve-angular-routes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Angular 2 Fundamentals


resolve-angular-routes

Resolve Angular 2 Routes for Context

npm install --save-dev @angularclass/resolve-angular-routes

src/
 ├──about/
 |    └──index.ts  // NgModule or Component with either
 |
 └──index.ts // routes

// the router resolve will look for these static properties
// 'routes', 'ROUTER_CONFIG', or 'ROUTE_CONFIG'

// ngRoutes from index.ts
[
  { path: 'about', component: './about' }
]

// context map created
{
  './about': './app/about'
}
import 'core-js/es6';
import 'core-js/es7/reflect';

const resolveNgRoute = require('@angularclass/resolve-angular-routes');

module.exports = {
  // etc
  plugins: [
    new ContextReplacementPlugin(
      /angular\/core\/src\/linker/,
      root('./src'), // root() __dirname helper
      resolveNgRoute(root('./src'))
    ),
  ]
  // etc
}

enjoy — AngularClass



AngularClass ##AngularClass

Learn AngularJS, Angular 2, and Modern Web Development from the best. Looking for corporate Angular training, want to host us, or Angular consulting? [email protected]


Apache-2.0

About

Resolve Angular 2 Routes for Context

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published