I am building an ember app. I have two pages. One shows list of feeds and another (which opens on click on one feed) shows details of the feed
Every thing is working fine but when i pres browser's back button from feed details page then it throws error and previous page which is feed list page doesn't load.
Here's error i am getting
Error while processing route: feed.index Cannot convert object to primitive value TypeError: Cannot convert object to primitive value
at EmptyObject.SETTER_FUNCTION [as likes] (http://ift.tt/2nrhwSf)
at assign (<anonymous>)
at InternalModel.setupData (http://ift.tt/2oav0PH)
at Class._load (http://ift.tt/2nrkUwB)
at Class._pushInternalModel (http://ift.tt/2oaoBDW)
at Class._push (http://ift.tt/2nrlxq6)
at http://ift.tt/2oaipvD
at Backburner.run (http://ift.tt/2nrhzgT)
at Class._adapterRun (http://ift.tt/2oaqyAk)
at http://ift.tt/2nryXCf
ember.debug.js:17631 TypeError: Cannot convert object to primitive value
at EmptyObject.SETTER_FUNCTION [as likes] (ember.debug.js:21402)
at assign (<anonymous>)
at InternalModel.setupData (internal-model.js:258)
at Class._load (store.js:1736)
at Class._pushInternalModel (store.js:2097)
at Class._push (store.js:2037)
at finders.js:166
at Backburner.run (ember.debug.js:718)
at Class._adapterRun (store.js:2295)
at finders.js:164
My feed model is below
import DS from 'ember-data';
const{attr} = DS;
export default DS.Model.extend({
"likes": attr('number'),
"userLiked": attr('number'),
"commentCount": attr('number'),
"description": attr('string'),
"date": attr('string'),
"tags": attr(),
"imagePath": attr('string'),
"link": attr('string'),
"userId": attr('number'),
"userName": attr('string'),
"name": attr('string'),
"title": attr('string'),
"visitCount": attr('number')
});
model method of my route is as below
model(){
var inflector = Ember.Inflector.inflector;
inflector.irregular('feed', 'feeds.php');
inflector.uncountable('advice');
const authData = getAuthData();
if(authData.loggedInUser != null){
return this.get('store').query('feed',{page:1,loggedInUser:authData.loggedInUser});
}
}
I tried debugging the code from chrome's dev tool. Everything works perfectly. But it throws error somewhere in ember-debug.js (which i assume is generated code)
Below is the method in ember-debug.js where error starts from
function MANDATORY_SETTER_FUNCTION(name) {
function SETTER_FUNCTION(value) {
var m = _emberMetalMeta.peekMeta(this);
if (!m.isInitialized(this)) {
m.writeValues(name, value);
} else {
_emberMetalDebug.assert('You must use Ember.set() to set the `' + name + '` property (of ' + this + ') to `' + value + '`.', false);
}
}
SETTER_FUNCTION.isMandatorySetter = true;
return SETTER_FUNCTION;
}
Could you please help here, what i am doing wrong?
Aucun commentaire:
Enregistrer un commentaire