mirror of
https://github.com/nasa/openmct.git
synced 2025-06-15 13:48:12 +00:00
[Edit] Bind action to .perform() inside mct-button
This commit is contained in:
@ -25,7 +25,7 @@
|
|||||||
<mct-control key="'button'"
|
<mct-control key="'button'"
|
||||||
structure="{
|
structure="{
|
||||||
text: saveActions[0].getMetadata().name,
|
text: saveActions[0].getMetadata().name,
|
||||||
click: saveActions[0].perform,
|
click: actionPerformer(saveActions[0]),
|
||||||
cssclass: 'major ' + saveActions[0].getMetadata().cssclass
|
cssclass: 'major ' + saveActions[0].getMetadata().cssclass
|
||||||
}">
|
}">
|
||||||
</mct-control>
|
</mct-control>
|
||||||
@ -45,7 +45,7 @@
|
|||||||
<mct-control key="'button'"
|
<mct-control key="'button'"
|
||||||
structure="{
|
structure="{
|
||||||
text: currentAction.getMetadata().name,
|
text: currentAction.getMetadata().name,
|
||||||
click: currentAction.perform,
|
click: actionPerformer(currentAction),
|
||||||
cssclass: currentAction.getMetadata().cssclass
|
cssclass: currentAction.getMetadata().cssclass
|
||||||
}">
|
}">
|
||||||
</mct-control>
|
</mct-control>
|
||||||
|
@ -61,6 +61,12 @@ define(
|
|||||||
$scope.otherEditActions = $scope.action ?
|
$scope.otherEditActions = $scope.action ?
|
||||||
$scope.action.getActions(OTHERS_ACTION_CONTEXT) :
|
$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
|
// Update set of actions whenever the action capability
|
||||||
|
Reference in New Issue
Block a user