I'm trying to access properties of a controller (actually a mixin extended by a controller) in Ember, and I need to use the {{#with}} handlebars helper. I get the error:
Cannot read property 'lookupFactory' of undefined
The place I'm trying to specify the controller for each looks like this:
{{#with orders.order controller='ordersIndex'}}
I have also tried just about every combination I can think of:
{{#with orders.order controller='orders'}}
{{#with orders.order controller='Orders'}}
Tried specifying the controller for the route that seems to work:
{{#with orders.order controller='brokerageAccount'}}
{{#with orders.order controller='BrokerageAccount'}}
{{#with orders.order controller='Brokerage'}}
No luck with any of them.
All Code is in JSBin: http://emberjs.jsbin.com/cabak/1/edit?html,js
Output view of the two routes:
Broken one: (here if you open the console, you'll see the error) http://emberjs.jsbin.com/cabak/1#/orders
This one works: you'll see some data. http://emberjs.jsbin.com/cabak/1#/orders/tradier/12345
I guess there is a bug with the {{with}}
helper, because if you use the {{#each elem in model}}
and update the {{with}} to use the elem
variable: {{#with elem.orders.order controller='ordersIndex'}}
all works.
This is the updated orders/index
template:
<script type="text/x-handlebars" data-template-name="orders/index">
<div class="inline-headers">
<h4><label>Brokerage: </label>{{titleize brokerage}}</h4>
</div>
{{#each elem in model}}
<h4 class="account-header"><label>Account: </label>{{account_number}}</h4>
{{#with elem.orders.order controller='ordersIndex'}}
{{partial "_orders_table"}}
{{/with}}
{{/each}}
</script>
And this is the updated jsbin http://emberjs.jsbin.com/piwuyare/1#/orders
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.