29 lines
591 B
JavaScript
29 lines
591 B
JavaScript
import ngModule from '../../module';
|
|
|
|
/**
|
|
* Component used to fill slots with content.
|
|
*/
|
|
export default class Portal {
|
|
constructor($transclude, vnSlotService) {
|
|
this.$transclude = $transclude;
|
|
this.vnSlotService = vnSlotService;
|
|
}
|
|
|
|
$postLink() {
|
|
this.vnSlotService.push(this.slot, this.$transclude);
|
|
}
|
|
|
|
$onDestroy() {
|
|
this.vnSlotService.pop(this.slot);
|
|
}
|
|
}
|
|
Portal.$inject = ['$transclude', 'vnSlotService'];
|
|
|
|
ngModule.component('vnPortal', {
|
|
controller: Portal,
|
|
transclude: true,
|
|
bindings: {
|
|
slot: '@'
|
|
}
|
|
});
|