If the 'action' attribute is there, my-submit still not prevent default. Without the action attribute, the user agent won't send your data. Consider sending your form via XHR and FormData instead, in order to send the form exactly as the browser would normally, without triggering navigation.
> On Apr 22, 2015, at 1:19 AM, Funny Cherry <[email protected]> wrote: > > Hi. > I have a form kind of: > >> <div class="input"> >> <div id="chat" data-channel="/messages" >> data-recipient-id="3"></div> >> <form class="new_message ng-pristine ng-valid" >> ng-action="http://localhost:3000/api/v1/messages" name="NewMessageForm" >> ng-submit="submit()" novalidate ng-controller="MessagesController as >> MsgCtrl" id="new_message" accept-charset="UTF-8" data-remote="true"><input >> name="utf8" type="hidden" value="✓"> >> <textarea name="new_message_text" id="message_text" >> ng-model="NewMessageFormData.text"></textarea> >> <input type="hidden" ng-init="NewMessageFormData.recepientId = >> 3" ng-model="NewMessageFormData.recepientId"> >> </form> >> </div> > > > After I submit this form and after submit() function finish work, I get page > reload. > How to prevent it? > > -- > You received this message because you are subscribed to the Google Groups > "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
