I am taking the first steps with Angular 2 and Angular in general, and I am wondering how to set up the landing page.
My goal is to show the landing page every time a user doesn’t have a token in local storage or in a cookie.
My app.component.ts is as follows
import {Component} from 'angular2/core'; import {ROUTER_DIRECTIVES, RouteConfig} from 'angular2/router'; import {NavbarComponent} from './navbar.component'; import {LoaderComponent} from './loader.component'; import {NameListService} from '../shared/index'; import {HomeComponent} from '../+home/index'; import {AboutComponent} from '../+about/index'; @Component({ selector: 'g-app', viewProviders: [NameListService], templateUrl: 'app/components/app.component.html', directives: [ROUTER_DIRECTIVES, NavbarComponent, LoaderComponent] }) @RouteConfig([ { path: '/', name: 'Home', component: HomeComponent }, { path: '/about', name: 'About', component: AboutComponent } ]) export class AppComponent { }
/ home and / about are also components, if I understand correctly. Now I would like to have a separate page that does not have access to the navigation bar. This is what the user will always land if he does not log in.
It would be great if someone could help me get started, or at least point me in a good direction, maybe point me to a good Angular 2 tutorial.
This is the template that I'm based on the app https://github.com/mgechev/angular2-seed
source share