Accessing child views now that viewName is gone?


#1

Before you used to be able to access child views in the parent view by setting the viewName attribute on the child’s view helper. Does anybody know why this was removed? Is there an alternative way of accessing particular child views without using _childViews property? I suppose I could continue to use the viewName attribute and iterate through _childViews and check the viewName attribute of each child view.

Ember-easyForm uses viewName to set the “for” attribute of the label, which is now not being set.

I’m using Ember 1.9.2+pre.


#2

I think the best solution is to have child views register themselves with their parentView that they know needs to know about them. You could have them notify their parent on didInsertElement, and notify of removal on willDestroyElement.


#3

viewName does indeed work, I whipped up an example here: http://emberjs.jsbin.com/rwjblue/269/edit?html,js,output


#4

Yes you’re right. I think I read somewhere in the forums that it had been removed and presumed my problem with Ember easyForm was that. I need to dig deeper.


#5

@rwjblue I just noticed while upgrading to ember 2.8.0 that viewName seems to be gone for good (your commit). How should one access child views now? The childViews array doesn’t seem very predictable because how would one know which view is which?