Skip to content

Commit

Permalink
[Edit] Bind action to .perform() inside mct-button
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex M committed Sep 27, 2016
1 parent 4b51e60 commit a34e89d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions platform/commonUI/edit/res/templates/edit-action-buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<mct-control key="'button'"
structure="{
text: saveActions[0].getMetadata().name,
click: saveActions[0].perform,
click: actionPerformer(saveActions[0]),
cssclass: 'major ' + saveActions[0].getMetadata().cssclass
}">
</mct-control>
Expand All @@ -45,7 +45,7 @@
<mct-control key="'button'"
structure="{
text: currentAction.getMetadata().name,
click: currentAction.perform,
click: actionPerformer(currentAction),
cssclass: currentAction.getMetadata().cssclass
}">
</mct-control>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ define(
$scope.otherEditActions = $scope.action ?
$scope.action.getActions(OTHERS_ACTION_CONTEXT) :
[];

// Required because Angular does not allow 'bind'
// in expressions.
$scope.actionPerformer = function (action) {
return action.perform.bind(action);
};
}

// Update set of actions whenever the action capability
Expand Down

0 comments on commit a34e89d

Please sign in to comment.