If I have a component with a template containing an Edit
button. When the user clicks on it, I want to load another component as a dynamic modal template. The component is named ProfilePictureModalComponent
and it includes the Edit
button:
(Angular code here)
Here is the template for
profile-picture-modal.template.html
:
(HTML code here)
When the edit button is clicked, this component loads another component called EditProfilePictureComponent
within a modal. Here is the code for EditProfilePictureComponent
:
(More Angular code here)
The goal is to set the previous profile picture of the user when the Edit
button is clicked and the modal template is rendered. To achieve this, I need to call
EditProfilePictureComponent.editProfilePic()
from ProfilePictureModalComponent.editProfileModal()
. Since there is no direct relationship between the two components, I used a shared service. Now, I also need to access the methods within the shared service.