0
我沒有得到我當前的代碼錯誤。無法獲取此表單以在AngularJS中提交?
var app = angular.module('mgcrea.ngStrapDocs', ['ngAnimate', 'ngSanitize', 'mgcrea.ngStrap']);
app.controller('MainCtrl', function($scope) {
});
angular.module('mgcrea.ngStrapDocs')
.controller('NavbarDemoCtrl', function($scope, $location) {
$scope.$location = $location;
});
app.controller ('formController',[ '$scope', '$http', function($scope, $http) {
$scope.formData = {};
$scope.processForm = function() {
console.log('Click');
$http({
method : 'POST',
url : '/users/login',
data : $scope.formData
}).success(function(data, status, headers, config) {
console.log(data);
}).error(function() {
console.log("ERROR")
});
}
}]);
use strict;
我確認url:localhosts/users/login通過Postman接受發佈數據。但是,將所有內容組合在一起,我發現我實際上無法將表單提交給api。我不確定是否存在一些有衝突的代碼,或者我之前提到的問題具體是什麼,我目前沒有發現任何錯誤。
另外,這裏是一個粘貼bin鏈接到html如果似乎沒有問題與js。
我得到它的堆棧跟蹤打印關中標記JavaScript的SRCS列表的模塊錯誤。這是否意味着我錯過了某處的依賴關係? – jimmyjacks
是的,好像你錯過了'ngSanitise'文件。如果你不需要它,只需從第一行的數組中移除ngSanitise條目('var app = angular.module(...'))。 – GregL