Open modal dialog in a function in Angular 4

Viewed 7519

I have an angular 4 application and I want to open a modal dialog in a function.

So, I have my modal code that I can open when I click on a button :

<button class="btn btn-primary" id="test" (click)="open(addProjectForm)">test</button>

But I want to open the modal from a function in the ngOnInit of component.ts.

So, how can I open the modal inside a function and not with the click option ?

1 Answers
Related