I want to reference a containerview as a property of a parentview.
For example, in the parentView's template, I want to define the containerView like this:
<a {{action toggleForm target="view"}} class="btn btn-primary" href="#">Create</a>
{{view view.formContainer}}
And then I want to be able to change the currentView of the containerView in the parentView like this:
toggleForm: (e) ->
e.stopPropagation()
@get('formContainer').set('currentView', Em.View.create())
But the problem being is that he formContainer property references the class and not the instance.
I can access it like this from the childViews collection:
formContainer = @get('childViews.firstObject')
But obviously, if the view stops being the firstObject then my code breaks.
How can I reference the instance without going through the childViews collection or is this possible like this?