Angularjs 注册时的CORS问题
身份验证控制器代码Angularjs 注册时的CORS问题,angularjs,laravel-5.1,Angularjs,Laravel 5.1,身份验证控制器代码 angular.module('wwwApp') .controller('RegisterCtrl', function ($scope,$auth) { $scope.loginForm={}; $scope.loginForm.email=''; $scope.loginForm.password=''; $scope.register1=function() { con
angular.module('wwwApp')
.controller('RegisterCtrl', function ($scope,$auth) {
$scope.loginForm={};
$scope.loginForm.email='';
$scope.loginForm.password='';
$scope.register1=function() {
console.log('hi');
$auth.signup($scope.loginForm).then(function (response) {
console.log('hi');
console.log(response);
//$state.go('dashboard');
}).catch(function (response) {
console.log(response);
window.alert('Error: Register failed');
});
};
});
这是用于注册用户的控制器代码,
但请求的资源上不存在“Access Control Allow Origin”头。因此,不允许访问源“”。响应的HTTP状态代码为500。问题是什么?错误消息非常具有描述性-关于这个问题有很多现有的SO答案。是的,我知道实际上我的.htaccess文件出错了,现在一切正常,但注册后没有生成令牌。问题是什么?错误消息是非常描述性的-有很多关于这个问题的现有答案。是的,我知道实际上我的.htaccess文件出错了,现在一切正常,但注册后,令牌没有生成。。
public function register(Request $request)
{
$newUser = $request->create([
'name' => $request->get('name'),
'email' => $request->get('email'),
'password' => bcrypt($request->get('password'))
]);