2019-11-10 10:08:44 +00:00
|
|
|
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'];
|
|
|
|
|
2020-07-24 15:46:06 +00:00
|
|
|
ngModule.vnComponent('vnPortal', {
|
2019-11-10 10:08:44 +00:00
|
|
|
controller: Portal,
|
|
|
|
transclude: true,
|
|
|
|
bindings: {
|
|
|
|
slot: '@'
|
|
|
|
}
|
|
|
|
});
|