I have this Idea in my head, there is an ConfrimModal component, which extends the regular Modal.
code wise its very efficient, since I can write all the basic code(TypeScript) inside the modal, and then just add specific stuff to ConfirmModal to finish.
can I do something similar with the HTML, that there is a basic envelope(which is inherited from Modal, and then I add all the stuff I need inside using another template)?
modal.component.ts
@Component({
selector: 'app-modal',
template: '<section></section>'})
export abstract class ModalComponent{
protected modalService: BsModalService;
protected constructor(receivedModalService: BsModalService) {
this.modalService = receivedModalService;
}
}
confirm-modal.component.ts
@Component({
selector: 'app-confirm-modal',
template: '<div>Hi its a test</div>',
styleUrls: ['./confirm-modal.component.css'] })
export class ConfirmModalComponent extends ModalComponent implements OnInit {
constructor(protected modalService: BsModalService) {
super(modalService); }
ngOnInit() { }
}
and I want the final result to be
<section><div>Hi its a test</div></section>
by using something in the spirit of OOP.
I tried using ng-content but found it to be inappropriate.
succeed by passing plain HTML, but it causes problems with the binding[besides being an unAngulary way to handle the situation].