Kamikaze Stifler
Kamikaze Stifler

Reputation: 109

Ionic 4 - Button created with Jquery dont call event

I'm using Ionic 4 in my project, where I'm using with Jquery, on the html page I've created a button with the following code:

<ion-button (click)="event1()">EVENT1 < / ion-button>

in page .ts I created the function that performs an append inside a div, that is, every time I click on the event1 button a new input is created.

event1 () {
//i remove the appends codes and bla bla bla
<div> <div> </ div> <div id = "goku" (click) = "event2 ()" <div class = > </ ion-button> </ div>
}

which works and creates the inputs with a button next to it.

but when I click the button that came along with the input I should call event2

in my .ts file below event1 I created the function

event2 () {
alert ('Hi i am Goku')
}

but no event is called, just as no error is displayed on the console.

but if you create it manually in the html file, the

the event is called without problems.

Upvotes: 0

Views: 265

Answers (2)

Fernando Garza
Fernando Garza

Reputation: 34

maybe the best way is create the button with an array iterator. When you do click on the first event, push in an array the ID for the next button, and in the view do the data iterator. I don't know if I explain.

Upvotes: 1

Ben Hulan
Ben Hulan

Reputation: 547

It’s better to avoid mixing jQuery with Angular for both style and performance. You might check out the Ionic Forum as a resource for Ionic-specific questions.

Upvotes: 0

Related Questions