I have a form that calls a function when being submitted through the attribute, for example:
ng-submit="submit('POST', 'example.com')"
I would like this attribute to be called just the function, and in the function that data would be taken through the other attributes, for example:
<form action="example.com" method="POST" ng-submit="submit()">
<! ... >
</form>
$scope.submit = function() {
let action = this.action;
let method = this.method;
// ...
}
But using only this
does not work. I've already taken a look at the angular.element , but I found it much more difficult and not worth much , I would like something simpler, to leave the HTML clean without getting JS too dirty, separating the variables that I will use in two different attributes, in case I need to change them dynamically. How could I do that?