<分区>
我一直在尝试使用 Angular JS 进行搜索 但是我得到了这个奇怪的错误:TypeError: undefined is not a function 成功了
这是我的代码:
<html ng-app="app">
<head>
<meta charset="utf-8">
<script src="angular.js"></script>
<script>
var app = angular.module('app', []);
app.controller('ctrl', function ($scope, $http){
$scope.url = 'fetch.php';
$scope.search = '';
$scope.postLink = function(){
$http.post($scope.url, { "data" : $scope.search}).succes(function(data, status){
console.log(data);
}).error(function(data, status) {
$scope.data = data || "Request failed";
$scope.status = status;
});
}
});
</script>
</head>
<body ng-controller="ctrl">
<input type="text" ng-model="search">
<input type="submit" ng-click="postLink()">
</body>
</html>
谁能告诉我为什么它在 .succes 上给我一个错误?我不允许在那里打电话吗?
提前致谢!