0
我烬版本:如何使用Bootstrap-3-Typeahead使用embe-data?
DEBUG: -------------------------------
Ember : 2.11.0
Ember Data : 2.11.1
jQuery : 3.1.1
Ember Simple Auth : 1.2.0
DEBUG: -------------------------------
我用ember data
之前,我有一个这样的组件:
import Ember from 'ember';
export default Ember.TextField.extend({
didInsertElement: function() {
var _this = this;
this.$().typeahead({
source: function(query, process) {
$.getJSON("/api/" + _this.get('modelName'), {query: query, access_type: 'typeahead'}, function(data) {
process(data);
});
}
})
},
willDestroyElement: function() {
this.$().typeahead('destroy');
}
})
使用这个组件:
{{typeahead-input type="text" modelName='shipping_spaces' value=shippingSpace class="form-control"}}
而且随着Bootstrap-3-Typeahead
此组件的工作( https://github.com/bassjobsen/Bootstrap-3-Typeahead)。
但是,当我使用ember-data
到我的项目中,我不知道如何使用Bootstrap-3-Typeahead
与ember-data
一起使用。由于所有数据来自this.store.query('order')
,因此不再使用ajax
。
所以,如果我必须使用typeahead
,我必须设计一个addo
?谢谢。
感谢。完善。 – JeskTop