0
I’m having some headaches, because I need to create a function to validate when the link should redirect to the place or when it should not for example if I am loading an image and it click the link should not load, I created a function like this in jquery, but I need one that’s angled, you can help me?
follows the function in jquery:
$(document).ready(function () {
$('a').click(function (event) {
var url = $(this).attr('href');
if (alterado === true) {
//console.log("teste");
bootbox.confirm('Existem dados não salvos, deseja continuar?', function (resp) {
if (resp) {
location.href = url; // acessa o link indicado na tag a
} else {
event.preventDefault(); // cancela o evento
}
});
return false;
}
});
});
this "changed" variable comes from where?
– rzani
of another controler, only a function that returns true or false
– Tales Born
This code works in jQuery and you want to convert it to Angularjs, this?
– Juan Biscaia
exact, create a function that does the same thing, but that is in Engineering
– Tales Born