Created
March 20, 2017 11:53
-
-
Save feanor07/a792a9366547a6780b65e54592247423 to your computer and use it in GitHub Desktop.
stackoverflow question #42833778
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 Ember from 'ember'; | |
var data = { | |
"pizzas": [{ | |
"id": 1, | |
"name": "pizza 1" | |
}, { | |
"id": 2, | |
"name": "pizza 2" | |
}] | |
}; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
actions: { | |
queryPizzas(query, deferred) { | |
console.log(query.term); | |
new Ember.RSVP.Promise(function (resolve) { | |
setTimeout(function () { | |
console.log(data); | |
resolve(data); | |
}, 300) | |
}).then(function(data) { | |
//try to pass the array as the data | |
deferred.resolve({data: data.pizzas, more: false}); | |
}, deferred.reject); | |
} | |
} | |
}); |
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
{ | |
"version": "0.11.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.11.0", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.11.0", | |
"ember-testing": "2.11.0" | |
}, | |
"addons": { | |
"ember-select-2": "1.3.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment