[Edit] Bind action to .perform() inside mct-button

This commit is contained in:
Alex M 2016-09-27 21:19:25 +03:00
parent 4b51e604a7
commit a34e89d56a
2 changed files with 8 additions and 2 deletions

View File

@ -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>
@ -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>

View File

@ -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