Hi, does anyone have a code sample on how to do a custom modal that can be ‘reused’ in any component?
My first thought was to define this custom modal as a “service” using
What I am after is to create a “CustomModal” class that I can use in any other component ( lets say Z). Z should not have to import
ModalController or a template to display. All of this needs to be inside CustomModal and I should be able to associate a variable in the constructor of Z, say, myModal that can simply be used to do a
myModal.dismiss. It doesn’t need to be in the constructor, any other method is fine, as long as the CustomModal component handle the modal instantiation and template
All examples of @Injectables don’t include a
selector or a
templateUrl which I want to be part of this ‘reusable modal’
So what is the right approach and is Injectable correct to use for this?