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
- 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)
- 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
- The Angular application is found in the
app/
directory
- 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.
- Use the Angular CLI