samedi 27 février 2016

CORS issue when registering

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');
            });
        };

    });

Code of auth controller

public function register(Request $request)
    {
        $newUser = $request->create([
      'name' => $request->get('name'),
      'email' => $request->get('email'),
      'password' => bcrypt($request->get('password'))
    ]);

this is the controller code for registering the user, but it displaying No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access. The response had HTTP status code 500.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire