I'm quite new to angular. I'm trying to show my modal when I click a marker. It compiles succesfully and then outputs error. Sometimes doesnt compile succesfully. How can I fix this error? Is it because I set up jquery wrong? All of this code is in a component called HomeComponent. Code and error:
Asked
Active
Viewed 636 times
-2

Tomajuli
- 27
- 1
- 1
- 5
1 Answers
1
The m variable
is no need in this case, you can remove it.
If you need pass parameter you can set #variable
and pass it to markerClick
.
(markerClick)="markerClick()"
markerClick(){
$("myModal").modal("show");
}

Hien Nguyen
- 24,551
- 7
- 52
- 62
-
Yeah, it's expecting 1 input if I remove the m. If you dont mind could you show me how to do it? – Tomajuli May 06 '20 at 12:57
-
https://pastebin.com/fvqyNhcX , I tried to remove the marker passable parameter but the click didn't do anything. – Tomajuli May 06 '20 at 13:10
-
with your html code, i think you don't need pass parameter, if you want you can pass $event as (markerClick)="markerClick($event)" – Hien Nguyen May 06 '20 at 13:15
-
markerClick($event : MouseEvent){ console.log($event) $("myModal").modal("show"); } like this? It registers the click but doesnt pop up the modal, and I changed the html code as you said – Tomajuli May 06 '20 at 13:21
-
did you install bootstrap for your app? – Hien Nguyen May 06 '20 at 13:29
-
yeah I set it up when I started the project, I have "node_modules/bootstrap/dist/js/bootstrap.min.js" in the angular json. – Tomajuli May 06 '20 at 13:34