我目前正在尝试获取一个简单的角度(v 1.4)表单来提交数据,但是到目前为止,当我单击“提交”按钮时没有任何反应,我有以下html代码;
<form name="requestForm">
<textarea ng-model="specialOffer" name="specialOffer" rows="5" required></textarea>
<md-button class="md-raised md-primary" ng-click="postOffer()">Submit</md-button>
</form>
这是模型。我想念我吗?;
angular.module('modulename').controller("codeController", function ($scope, $http) {
$scope.postOffer = function () {
if ($scope.specialOffer == null) {
return false;
}
$http({
method: 'POST',
url: '#',
data: {specialOffer: $scope.specialOffer}
}).then(function successCallback(data) {
console.log(data);
$location.path('requests');
}, function errorCallback(response) {
//Error
});
};
});