Reputation: 14416
If I have a custom component with it's own function.
export class ModalWindow {
public modalelement: HTMLElement;
show() {
$(this.modalelement).modal('show');
}
}
Is there a way of exposing show()
for other elements (like a button on my page) to call?
<modal-window></modal-window>
<button click.delegate="modal-window.show()">Show modal</button>
Upvotes: 1
Views: 150
Reputation: 14416
Flipping heck, spent ages trying to work this out and finally decided to post here. 5 minutes later, I work it out:
<modal-window view-model.ref="addmodal"></modal-window>
<button click.delegate="addmodal.show()">Show modal</button>
I am happy to hear of any better options if you can think of anything?
Upvotes: 2