Hello, Folks. I support old (1.7) pre-1.13 version of Ember and stunned with same issue to add multiple actions. Upgrading is overkill for this cause this is eak-based (not ember-cli) project.
So the only solution for me is to use component.
But with which I stunned is, how to connect this component with addToCart action from my views.
Please help.
export default Em.Component.extend({
classNames: ['addToCart2'],
tagName:'button',
click: function(e) {
return this.triggerAction({
action: 'addToCart',
actionContext: this.get('content')
});
console.log('click');
},
doubleClick: function(e) {
this.get('content').incrementProperty('selected', 10);
console.log('dclick');
}
});
External action situated in app/views/food-list’ :
import SortableList from 'app/views/sortable-list'
import ItemView from 'app/views/sortable-list-item'
export default SortableList.extend({
positionField: 'position',
includedModel: 'food',
sortingArray: 'menuFoods',
handle: '.drag-handler',
itemViewClass: ItemView.extend({
templateName: 'menu/food_item',
isAdmin: Em.computed.alias('controller.isAdmin'),
isVisibleObserver: function() {
if (this.get('content.isDirty')) {
this.get('content').save();
}
}.observes('content.isVisible'),
isEmpty: Em.computed.lt('content.selected', 1),
actions: {
addToCart: function() {
this.get('content').incrementProperty('selected');
}
...
Errors:
EmberError {description: undefined, fileName: undefined, lineNumber: undefined, message: "Nothing handled the action 'addToCard'. If you did…er in a controller, causing the action to bubble.", name: "Error", …}description: undefinedfileName: undefinedlineNumber: undefinedmessage: "Nothing handled the action 'addToCard'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble."name: "Error"number: undefinedstack: "Error: Nothing handled the action 'addToCard'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble.↵ at new EmberError
Uncaught TypeError: Cannot read property 'incrementProperty' of undefined
@stefan @lukemelia @nate @Kilowhisky @Charles_Bourasseau @Gaurav0 @barneycarroll @lvl99