Created
January 11, 2016 15:14
-
-
Save iksose/4a8f1cfb1e7dfbf26249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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