algairim commented on a change in pull request #229:
URL: https://github.com/apache/brooklyn-ui/pull/229#discussion_r655949969
##########
File path:
ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
##########
@@ -68,6 +68,30 @@ export function saveToCatalogModalDirective($rootScope,
$uibModal, $injector, $f
}
}
Review comment:
Correction: it is better to define methods above at the controller
level, not at directive:
```
export function saveToCatalogModalDirective($rootScope, $uibModal,
$injector, $filter, composerOverrides, blueprintService) {
return {
restrict: 'E',
templateUrl: function (tElement, tAttrs) {
return tAttrs.templateUrl || TEMPLATE_URL;
},
scope: {
config: '=',
},
controller: ['$scope','composerOverrides',
saveToCatalogModalController],
link: link
};
function saveToCatalogModalController($scope, composerOverrides) {
let modalController = this;
modalController.getConfigNameFromEntity = (entity) => {
// use $scope directly
// code omitted ...
};
// etc. ...
// allow downstream to configure directive and scope here
(composerOverrides.configureCatalogModal || function ()
{})(modalController, $scope);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]