Devin Dixon
Devin Dixon

Reputation: 12403

AngularJS Stop blocking form

I'm relatively new to AngularJS and I am trying to sumbit a regular form. I have basic form that looks like this:

<form method="post" enctype="multipart/form-data">
input type="text" class="title span5" name="post_title" placeholder="A catchy title here..." value="" />

<input type="file" name="post_image" />

<input type="submit" class="btn btn-success" value="Create Post" />
</form>

But I noticed that AngularJS adds its own values to the form.

<form method="post" enctpye="multipart/form-data" class="ng-pristine ng-valid">

And I am ununable to submit the form. How can I disable the automatic validation that Angular JS is adding to the app?

Upvotes: 3

Views: 857

Answers (2)

Justin Noel
Justin Noel

Reputation: 6215

UPDATE : This does NOT work ... well at least not in a way you'd like it to. Adding ng-non-bindable to the form or any input breaks ALL binding. So, your ng-model in the inputs won't work anymore.


ng-non-bindable is possibly your best choice. It will prevent AngularJS from doing ANY validation. So, you'll be responsible for showing invalid and checking validity.

https://stackoverflow.com/a/19387233/75644

Upvotes: -1

Ye Liu
Ye Liu

Reputation: 8976

Quoted from the documentation:

For this reason, Angular prevents the default action (form submission to the server) unless the element has an action attribute specified.

IMHO, you should read the doc to gain some general understanding of single page application, and the reason why angular's preventing the default behavior.

Upvotes: 5

Related Questions