send the response of API from childcompent.ts to <ngb-toast> in parent comp template
- User
send the response of API from childcompent.ts to in parent comp template
- Assistant
In order to send the response of an API from child component.ts to in the parent component template, you can use Output and EventEmitter in Angular.
- In the child component.ts, create an Output property and EventEmitter to emit the response from the API.
typescript - User
not work well, the child comp is ngb modal so i want when click on button in this modal the modal close and toast show in parent page at bottom right
- Assistant
In that case, you can modify the approach slightly to achieve the desired behavior. You can still use Output and EventEmitter to send an event from the child component to the parent component, and then use this event to trigger the toast in the parent component template.
Here's how you can do it:
- In the child component.ts, create an Output property and EventEmitter to emit an event when the button is clicked in the modal.