[英]Failed to load resource: the server responded with a status of 405 (Method Not Allowed) api
When I run http-server -o with angularjs(frontend) to use api from symfony (backend) for login, I get this error: 当我运行HTTP服务器与symfony的(后端)进行登录angularjs(前端)使用的API -o,我得到这个错误:
Failed to load resource: the server responded with a status of 405 (Method Not Allowed) :8080/app/api/src/AppBundle/Controller/MainController.php
无法加载资源:服务器的响应状态为405(不允许使用方法):8080 / app / api / src / AppBundle / Controller / MainController.php
error Impossible d'accéder au serveur.
error不可能的服务。
connection.js connection.js
'use strict';
angular.module('myapplication.connection', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/connection', {
templateUrl: 'connection/connection.html',
controller: 'connectionCtrl'
});}])
.controller('connectionCtrl', ['$http', '$scope', function($http, $scope) {
$http.post('api/src/AppBundle/Controller/MainController.php', {formType:'connection'})
.then(function (response) {
$scope.connection = response.data;
}, function(response) {
$scope.connection = "Impossible d'accéder au serveur.";
});
}]);
connection.html(form) connection.html(form)
<div class="content">
<h2>Connexion</h2>
<div>{{ connection }}</div>
</div>
How do I solve this error? 我该如何解决这个错误?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.