Uncaught TypeError: this.jobs_service.stopJob is not a function at n.stopJob (ui.js:6) at ui.js:6 at Array.forEach () at n.stopQuery (ui.js:6) at u.T [as triggerEvent] (vendor.js:13) at Object.l [as trigger] (vendor.js:18) at u.trigger (vendor.js:18) at n.send (vendor.js:13) at n.send (vendor.js:14) at n.triggerAction (vendor.js:14)
Following is my service function: export default Ember.Service.extend({ stopJob : function(jobId) { //stopJob (jobId) { // this.setCurrentQueryAsCancelled(); return new Ember.RSVP.Promise((resolve, reject) => { let job = this.get(‘store’).peekRecord(‘job’, jobId); if(job) { job.destroyRecord(); } else { this.get(‘store’).findRecord(‘job’, jobId, { reload: true }) .then(job => { job.deleteRecord(); return resolve(“”); }).catch(function (response) { return resolve(“”); }); } }); }, }
and following is the code in route from where the function is called: stopJob(jobId) { var self = this; self.jobs_service.stopJob(jobId) .then(data => { //this.get(‘controller’).set(‘isJobCancelled’, true); console.log(“Job " + jobId + " stopped”); }).catch(function (response) { //self.get(‘controller’).set(‘isJobCancelled’, true); console.log(“Job " + jobId + " stopped”); }); },
What am I doing wrong here?Preformatted text