I have an ArrayController that I want to display the first item's contents when the view is first accessed, at the moment I am doing it like this:
App.SomeController = Em.ArrayController.extend
content: Ember.A()
active: null
contentDidLoad: ( ->
return unless @get('content.isLoaded') || @get('content.length') == 0 || @get('active')
@set('active', @get('firstObject'))
App.get('router').transitionTo('root.inbox.email', @get('active'))
).observes('content.isLoaded')
I don't like calling the router like this from the controller.
The way the content is usually displayed is from the click of an action helper like this:
<div {{action showEmail view.content href="true"}}>
But obviously no click will happen when the page first loads.
Is there better way?