How to set component output binding from ui bootstrap uibModal.open

For a component with output binding, for example:

angular.module('app').component('myComponent', { templateUrl: 'myComponent.html', bindings: { onSelect: '&' }, controller: class { selectedItems = []; // called when the user clicks a button, outputs an array of selected items selectItems() { this.onSelect({items: this.selectedItems}); } } }); 

If used as a tag, I can get the selected elements using this code:

 <my-component on-select='$ctrl.select(items)' /> 

How to achieve the same result using ui.bootstrap uibModal.open ?

This does not work:

 $uibModal.open({ component: 'myComponent', resolve: { onSelect: () => (items) => { console.log('parent event handler', items); } } }); 
+5
source share

All Articles