您好,我對某事感到有點困惑,當我發表我的表單數據沒有發送到服務器,我檢查了幾次我的控制檯,我無法理解發生了什麼,這是我的控制器:
angular.module('app').controller('InstCtrl', ['$http', '$scope', '$state', 'InstService', function($http, $scope, $state, InstService) {
var parameters = {
name: $scope.name,
description: $scope.description,
email: $scope.email,
phone: $scope.phone,
website: $scope.website,
isActive: $scope.isActive
};
$scope.addInstitution = function(parameters) {
InstService.add(parameters);
console.log(parameters);
};
}]);
這是服務:
angular.module('app').factory('InstService', function ($http) {
var InstService = {};
InstService.add = function(parameters) {
return $http
.post('/api/v1/institutions/', parameters)
};
return InstService;
});
我用我的服務器上的前端和laravel 5 AngularJS。
的console.log回報不確定 和我$ http.post總是空的,因爲在沒有數據被髮送到服務器。
它是什麼,你在你的控制檯,你不明白看? – Claies
對不起編輯我的帖子,包括那,謝謝。 – user3718908