Skip to content

Instantly share code, notes, and snippets.

@iksose
Created January 11, 2016 15:14
Show Gist options
  • Save iksose/4a8f1cfb1e7dfbf26249 to your computer and use it in GitHub Desktop.
Save iksose/4a8f1cfb1e7dfbf26249 to your computer and use it in GitHub Desktop.
import {Component} from 'angular2/core';
import {NgFor} from 'angular2/common';
import {Http} from 'angular2/http';
import template from './clients.html';
import {CanActivate, OnActivate, ROUTER_DIRECTIVES, RouteConfig} from 'angular2/router';
import {Service} from './clientResource';
import {Client} from '../classes/Client'
@Component({
selector: 'home',
directives: [ NgFor, ROUTER_DIRECTIVES ],
providers: [ Title ],
pipes: [],
// styles: [about],
template
})
@CanActivate(async(next)=>{
let service = new Service();
const response = await service.query();
next.params.message = response.results.map(x=> new Client(x))
return true;
})
export class List {
static parameters = []
constructor() {}
ngOnInit(foo) {
console.log('hello clients');
}
routerOnActivate(next) {
console.log("woop", next);
this.clients = next.params.message;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment