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

update:

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

jsFiddle with solution: Ember Latest - JSFiddle - Code Playground


I have asked the following on StackOverflow: javascript - Ember.js (1.2.0): get id into contained field - Stack Overflow

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: