29 lines
593 B
JavaScript
29 lines
593 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.vnComponent('vnPortal', {
|
|
controller: Portal,
|
|
transclude: true,
|
|
bindings: {
|
|
slot: '@'
|
|
}
|
|
});
|