Created
September 29, 2017 16:35
-
-
Save ccsilveira/4991552909afc2f8284355c4a1dd929b to your computer and use it in GitHub Desktop.
Figuring out how to get params from activate hook on aurelia
This file contains hidden or 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 {bindable, inject, NewInstance} from 'aurelia-framework'; | |
import {HttpClient, json} from 'aurelia-fetch-client'; | |
import {Router} from 'aurelia-router'; | |
@inject(NewInstance.of(HttpClient)) | |
export class Sprint { | |
tbColaborador; | |
constructor(http, sprintId) { | |
this.http = http; | |
this.getList(); | |
} | |
attached() { | |
} | |
activate(item) { | |
item = item.id; | |
} | |
getList(item) { | |
return this.http.fetch('http://10.1.70.103:3536/metricas/sprints/' + item) | |
.then(response => response.json()) | |
.then(data => { | |
console.log(data); | |
this.tbColaborador = data; | |
}) | |
} | |
} |
change item to params
this.routerParams = params; ???
retrieve id value from this.routerParams.id;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add routerParams variable