Created
December 12, 2016 19:58
-
-
Save JonathanVeg/ef842daf5284966d970c0adccce0d54c 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 Ember from 'ember'; | |
export default Ember.Service.extend({ | |
hour: -1, | |
// resumo dos problemas ocorridos naquela hora | |
resume_hour: [], | |
init(...params) { | |
this._super(params); | |
console.log("iniciando service"); | |
}, | |
setHour(hour) { | |
this.set('hour', hour); | |
let url = '/api/resume_hour/' + hour; | |
let promise = new Promise(function(resolve, reject) { | |
resolve($.getJSON(url)); | |
}); | |
promise.then(function(json) { | |
// resolve | |
console.log("JSON"); | |
console.log(json); | |
// isso n pega. o resume_hour n é acessivel dentro do promise. | |
// como fazer?! =\ | |
Ember.set(this, "resume_hour", json); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment