ng-submit

AngularJS - how to use ng-click without submitting the form?

谁都会走 提交于 2019-12-03 23:17:27
I have a form that has both ng-click and ng-submit. ng-submit is meant for the submission, while ng-click calls a separate function like upload, etc. How do I make sure that ng-click does not accidentally submits the form? thank you! meriadec ngClick does not submit the form. Sometimes, you can have problems because you have two button elements in your form , and they both submit it. To avoid that, specify the type "button" on it. Example : function demo ($scope) { $scope.doSubmit = function () { alert('I submit'); }; $scope.doClick = function () { alert('I click'); }; } <script src="https:/

ng-submit not working in angularjs

女生的网名这么多〃 提交于 2019-12-03 09:35:52
My view: <div class="modal" tabindex="-1" role="dialog" ng-controller="LocationController"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" ng-click="$hide()">×</button> <h4 class="modal-title"> Add a Location </h4> </div> <div class="modal-body"> <form class="form-horizontal" role="form" ng-submit="createLocation()"> <div class="form-group"> <label class="col-sm-2 control-label">Name</label> <div class="col-sm-10"> <input type="text" class="form-control" placeholder="Warehouse A, Row 15, Shelf BC1, etc" ng-model="name"> <

Why do we use form or ng-submit in angularjs?

痴心易碎 提交于 2019-12-02 11:24:25
问题 I am planning to have an angularjs application. We will be doing the CRUD operation using Web Api service. And these controller functions I can call from ng-click directive (I mean with out a submit) AngularJs <-> WebApi <-> Sql Serevr => This is our stack. We need get call to web server (to fetch files. Ex: images). But I am wondering, will we ever need a post operation into webserver in our case? Also, do we ever need a form,ng-form,submit,ng-submit - in our case? Any help would be

Why do we use form or ng-submit in angularjs?

谁都会走 提交于 2019-12-02 06:46:50
I am planning to have an angularjs application. We will be doing the CRUD operation using Web Api service. And these controller functions I can call from ng-click directive (I mean with out a submit) AngularJs <-> WebApi <-> Sql Serevr => This is our stack. We need get call to web server (to fetch files. Ex: images). But I am wondering, will we ever need a post operation into webserver in our case? Also, do we ever need a form,ng-form,submit,ng-submit - in our case? Any help would be apprecicated, Thanks! There are number of reasons outside of just submitting to use a <form> tag in your code.