0
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 just called the function, and in the function this data is 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 the this
doesn’t work. I’ve already looked at the angular element., but I found it much more work and not worth much, I would like something simpler, that leaves the HTML clean without mucking up the JS, separating the variables that I will use in two different attributes, in case I need to change them dynamically. How could I do that?