Well, as stated by the title, I’m having this problem, say, i have a form with multiple steps that i created using the ng-show property along with a function to set a $scope variable to an identifier in order to hide everything but the steps that the user should be undergoing, all worked fine, but then, i realise the form was being summited on every user click on the buttons to continue tho the next part of the form. in other words this:
it just won’t work at all, my form its not being submitted on every click, so thats an update on the situation, but its not working either, ¿why is this happening? ¿how can i fix it?.
Ended up solving my problem, setting the type property of button to “input” did the trick, still, i have ben left wondering as to why ng-click only works with buttons, at least inside form.
if you use onle one button without a specified type angularjs uses this button to submit a form -> triggering ng-submit.
Same thing, if you have different buttons in a form -> the first one will be used as submit button, also if there is another ng-click function on it.
@alfabc
this is more a hack if you will disable data-tapping on a button ^^.
You only have to follow base angularjs things… nothing more and nothing less… -.-
I still don’t understand why ng-click won’t work on div elements inside forms, as i have div with this attribute on other parts of my application and they work just fine. type=“button” work ok as well :D.
I have a similar issue (not necessarilly with divs and form).
I need to manipulate a text to turn some parts of it on hyperlinks that points to a function on my controller. This was the easy part, when i get the following string (the signal before the “a” on hyperlink is just to break formatation):