RE: Using angular in a template

thumbnail
Jon Ander Gonzalez, modified 6 Years ago. Junior Member Posts: 28 Join Date: 5/30/17 Recent Posts
Hello guys,

im trying to use angular in a template because i want to update the value of an input using jQuery in a form that has been done in angular, but the problem is that angular doesnt detect any change when it actually updates. the script is very easy
​​​​​​​function sendPersonalEmail(emailDestino) {
    
    var input = $('#email_destinatario');
    input.val(emailDestino);
    input.trigger('input');
    input.trigger('change');
    $("#email_destinatario")[0].dispatchEvent(new Event("input", { bubbles: true }));

i test to use angular.element(jQuery('#email_destinatario')).triggerHandler('change') aswell but the console give me an error "angular is not defined". i have read a lot of solutions similar to the last one but i cant manage to make it works. it seems that angular doesnt detect any change when is don in the client side.

Any suggestion about how can i do? how can i communicate to angular that an event has been taken place?

thanks in advanced
thumbnail
Javier Gamarra, modified 6 Years ago. Expert Posts: 348 Join Date: 2/12/15 Recent Posts
It's strange... I've tried with a small sample using dispatchEvent and it works. Code here
thumbnail
Jon Ander Gonzalez, modified 6 Years ago. Junior Member Posts: 28 Join Date: 5/30/17 Recent Posts
Muchas gracias Javier, me ha venido fenomenal.