Skip to content

A super simple starter kit for Angular 2 and its routing system

Notifications You must be signed in to change notification settings

danilodelfio/angular2-routing

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Angular 2 Routing

This project is for having a starting point for AngularJS 2 and Typescript and with the routing system in a simple way.

Takes a lot of cues from the Angular quickstart.

This is a great starter for getting straight to the Angular 2 and its routing system

Router Features

  • Route to different pages: Base routing system for routing through pages
  • Route with parameters: Passing parameter from different Components
  • Child Routes: Routes through sub-menu
  • Lazy Loading: Load resources when we visit the page (we want to load them incrementally)
  • Resolve: We can call some service into resolve attribute of routing system for not to show blank page until data is available and for kick back user to another view if it's not possible to resolve data.
  • Router Guards: use guards to act before activating a component (CanActivate, CanActivateChild): Allow users to navigate to page, for example for auth permissions.
  • Router Guards: use guards to act before leaving a component (CanDeactivate): Allow users to not to leave page if they haven't yet finished to work on it (example: update user profile)

Requirements

Installation

  • Clone the repo: git clone [email protected]:danilodelfio/angular2-routing
  • Choose the new directory: cd angular2-routing
  • Install dependencies: npm install
  • Start the app: npm start
  • View the app: http://localhost:3000

Usage

  • The Angular application is found in the app/ directory

Caveats

  • This is a very basic starter. If you want to use this in production, you're going to need to build out a lot more parts. Parts like:
  • Templates are referenced absolutely, which doesn't scale well.
    • You'd want to have your build system help with referencing templates relatively. Better to not absolutely reference them as they could get lost in build systems in larger apps.

More Production Ready Setup

About

A super simple starter kit for Angular 2 and its routing system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 82.8%
  • HTML 9.9%
  • JavaScript 7.3%