Unable to set default values ​​for line numbers and line types in Ember models

I am trying to set default types in Ember Model, but only some types work:

createdDate: DS.attr('date', {defaultValue: new Date()}) // Works createdDate: DS.attr('boolean', {defaultValue: false}) // Works createdDate: DS.attr('string', {defaultValue: "example"}) // Doesn't work - attribute null createdDate: DS.attr('number', {defaultValue: 99}) // Doesn't work - attribute null 

What am I missing?

+4
source share
1 answer

According to here , all your code is fine. However, it looks like . DefaultValue processes only undefined tags (your boolean and date). You can try to handle those null cases with a function in which you pass the second argument.

+1
source

All Articles