Ember.js (1.2.0): get id into contained field



I just found a work-around. By specifying ‘elementId’ for the ‘root’ parentView I can set the Id.

jsFiddle with solution: http://jsfiddle.net/EbenRoux/Xrb7Y/4/

I have asked the following on StackOverflow: http://stackoverflow.com/questions/21013950/ember-js-1-2-0-get-id-into-contained-field

We have a long-standing requirement from our testing team that the Ids be generated / provided for all elements. We have been assigning the elementIds / Ids for all our controls but I cannot get it to work when specifying an Id directly.

If we are going down the wrong route as mentioned in the answer by ‘theCoder’ I’d like to get that confirmed so that we can take that to our project owners and have it changed.


In your jsfiddle, you’re setting the same element Id on the parent and the child view. IDs are meant to be unique so I’m confused what you’re trying to achieve.


That was picked up by someone on SO also :smile:

I have fixed the SO question.

Just to clarify: the issue was actually in trying to get the parent id.


That was me on SO, but your solution for getting the parentView’s id is a good one. :smile: