UNPKG

ember-ajax

Version:

Service for making AJAX requests in Ember applications.

17 lines (14 loc) 372 B
import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import { get } from '@ember/object'; export default Route.extend({ ajax: service(), model() { return get(this, 'ajax').request('http://localhost:3000/posts', { dataType: 'json', headers: { 'Content-Type': 'application/json' } }); } });