coding, javascript

EmberJS – ongoing – part 3

Here is a situation:

API – Build on Rails , follows ActiveModel pattern (e.g. first_name)

EmberJS App – model uses camelized style for properties (e.g. firstName)

EmberJS requires an adapter for pulling data from some source (e.g. an API)
We have to use adapter that will deal with ActiveModel pattern

ApplicationAdapter = DS.ActiveModelAdapter.extend

Here is the caveat: Upgrading to Ember 1.8.1 will cause this error:

TypeError: undefined is not a function
at Object.func (http://localhost:4200/assets/vendor.js:49499:18)
at Object.Cache.get (http://localhost:4200/assets/vendor.js:25100:38)
at decamelize (http://localhost:4200/assets/vendor.js:49541:31)
at RESTSerializer.extend.keyForAttribute (http://localhost:4200/assets/vendor.js:63962:16)
at apply (http://localhost:4200/assets/vendor.js:32847:27)
at superWrapper [as keyForAttribute] (http://localhost:4200/assets/vendor.js:32419:15)
at null. (http://localhost:4200/assets/vendor.js:66421:31)
at null. (http://localhost:4200/assets/vendor.js:68910:20)
at cb (http://localhost:4200/assets/vendor.js:29082:22)
at OrderedSet.forEach (http://localhost:4200/assets/vendor.js:28880:13)

You might have to override an ActiveModelSerializer to handle the issue, however stick to Ember 1.7 and it’ll work.

Not loving the experience with Ember/EmberCLI

Share This:


EmberJS – ongoing

Strangest things happen when developing projects in EmberJS (specifically Ember CLI)

I have plenty of experience developing AngularJS based applications (mobile and desktop). EmberCLI is something a client wished based on their stack preference.

I won’t go into history of EmberJS but it was a turbulent one (at one point, it was in beta for over a year with little updates). It’s a lot more heavy (than Angular) on the dependencies and development approach (everything is a route, forget building small apps).


Odd errors:


Uncaught SyntaxError: Duplicate data property in object literal not allowed in strict mode


If you see the error above, i have resolved it by commenting out

proxiedSelectedStates: Ember.computed.filterBy(‘proxiedStates’, ‘checked’, true)
selectedStates: Ember.computed.mapBy(‘proxiedSelectedStates’, ‘content’)


Strangely enough, i don’t have a duplicate code and when i renamed these properties on a controller, everything worked. Magic !



Share This: