javascript framework - value is undefined in emberjs nested view -
i have script handlebar..
<script id="owneritem" data-template-name='owneritem' type="text/x-handlebars"> {{value.username}} <button {{action "remove" on="click"}}>remove</button> </script>
and view..
resadmin.ownerview = ember.view.extend({ templatename: 'owneritem', remove: function() { var selectedrest; selectedrest = resadmin.admincontroller.get('selectedrestaurant'); alert(value.restaurantownerid); return $.ajax({ url: '/api/restaurantowner/' + value.restaurantownerid, cache: false, type: 'delete', data: { restaurantid: selectedrest.restaurantid, methodoverride: 'delete' }, datatype: 'jsonp', success: function(data) { return resadmin.admincontroller.getrestaurantlist(); } }); } });
and in other view using view like
{{#each resadmin.admincontroller.selectedrestaurant.owners}} {{view resadmin.ownerview valuebinding="this" content="this"}} {{/each}}
but getting error(value not defined) when user click on remove button of nested view...can me ??
value property of ownerview need qualify this.get('value')
e.g.
this.get('value').restaurantownerid
Comments
Post a Comment