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');
});
};
});
auth控制器代码
public function register(Request $request)
{
$newUser = $request->create([
'name' => $request->get('name'),
'email' => $request->get('email'),
'password' => bcrypt($request->get('password'))
]);
这是用于注册用户的控制器代码, 但它显示 否'Access-Control-Allow-Origin'标头出现在请求的资源上。因此,不允许原点“http://localhost:9000”访问。响应的HTTP状态代码为500。