Monday, 15 September 2014

Computed property returns a function? Not sure if me or a bug in the latest ember.js -



Computed property returns a function? Not sure if me or a bug in the latest ember.js -

hey y'all i'm having weirdest issue in ember code. (1.0-pre4)

this seemingly innocuous code not working @ expected:

a = ember.controller.create({ hello: function(){ homecoming "hello"; }.property() } )

when a.get("hello") , instead of returning hello, returns function!

here dump:

i _cacheable: true _dependentkeys: array[0] func: function (){ homecoming "hello"; } __proto__: ember.descriptor

in handlebars templates shows [object object]

i'm not means seasoned ember programmer.. pretty sure used work differently. has changed?

however, have noticed when phone call a.hello.func() returns hello!

this doesn't create sense. doing wrong, or there issue ember??

any help appreciated. know question similar others, have no other way set downwards info in cohesive fashion in answers of others.

edit: think know issue is.. can't specify computed properties in 'create' function. seek 'extend' first , study back!

as of ember 1.0.0-pre.3, can no longer define computed properties via object.create(). in cases should using extend, if need old behavior can utilize createwithmixins().

see also:

https://github.com/emberjs/ember.js/commit/c1c720781c976f69fd4014ea50a1fee652286048

ember.object.create no longer supports defining methods phone call _super

ember.js

No comments:

Post a Comment