The amazing Angular 2 by Gerard Sans

  • import {Injectable} from ‘angular2/core’; @Injectable() export class LoginService { authorised = true; authorise(value) { this.authorised = value; } }
  • import {Injectable} from ‘angular2/core’; import {Http} from ‘angular2/http’; import ‘rxjs/add/operator/map’; import ‘rxjs/add/operator/retryWhen’; @Injectable() export class UsersService { constructor(private http:Http) { } get(){ return this.http.get(‘api/users.json’) .map(response => response.json()) .
  • @Component({ selector: ‘user-details’ }) @CanActivate(next => { let injector = appInjector(); let service = injector.get(LoginService); return new Promise(resolve => { resolve(service.authorised); }); }) export class UserDetails { }

Read the full article, click here.


@gerardsans: “Slides for “The Amazing Angular 2″ #jazoon #angularjs #gde ☀

Demo:”


Angular 2 comes with a new router that replaces previous ngRoute. We will compare the new router with ui-router and show how we can setup multiple views and nested routes.


The amazing Angular 2 by Gerard Sans

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.