0

When i executed this code inside a controller not found:

Index.html

<!DOCTYPE html>
<html ng-app="pfcAPP">

<head>

    <body>
    <title>pfcAPP</title>
</head>
<body>

<div data-role="page">
            <div ng-class="{ 'alert': flash, 'alert-success': flash.type === 'success', 'alert-danger': flash.type === 'error' }" ng-if="flash" ng-bind="flash.message"></div>
            <div ui-view></div>
</div>

    <!-- include Parse-Server files -->
    <script type="text/javascript" src="js/parse-1.6.14.min.js"></script>
    <!-- include Angular files -->
    <script src="//code.angularjs.org/1.2.20/angular.js"></script>
<!-- include APP files -->
    <script type="text/javascript" src="files/app/app.js"></script>      


</body>

</html>

app.js

    console.log('AppController');
   angular.module('APP',[])
    .run(run);

function run() {
    // keep user logged in after page refresh
    Parse.initialize("APPid","masterkey");
    Parse.serverURL = 'http://pfc:1337/parse';
    Parse.User.logIn('luisbg', 'test', {
        success: function(user) {
            // Do stuff after successful login.
            console.log(user);
        },
        error: function(user, error) {
            // The login failed. Check error to see why.
            console.log(error);
        }
    });

}

but if I execute this code out of controller, it found.

Parse.User.logIn('luisbg', 'test', {
                success: function (user) {
                  //  console.log(user);
                },
                error: function(user,error) {
                    console.log(error);
                }
            });

i got this error:

parse-1.6.14.min.js:15 POST http://192.168.2.103:3000/proxy/http%3A%2F%2Fpfc%3A1337%2Fparse%2Flogin 404 (Not Found) 
(index):120 s {code: 107, message: "Received an error with invalid JSON from Parse: Cannot GET /parse/login/parse/login↵"}

I have changed the nGroute for ui.router, and i have probed execute this code in other controller, and i have had the same problem in others controllers.

if I put code out of angular module, i will be OK.

    console.log('AppController');
Parse.initialize("APPid","masterkey");
        Parse.serverURL = 'http://pfc:1337/parse';
        Parse.User.logIn('luisbg', 'test', {
            success: function(user) {
                // Do stuff after successful login.
                console.log(user);
            },
            error: function(user, error) {
                // The login failed. Check error to see why.
                console.log(error);
            }
        });
       angular.module('APP',[])
        .run(run);

    function run() {
        // keep user logged in after page refresh


    }

With this code i can login or signup in parse, but when i use inside angular module, it use other url to GET LOGIN:

GET /parse/login/parse/login instead of GET /parse/login

Any idea?

1
  • Did you ever figure it out? @luisbg Commented Sep 26, 2017 at 0:45

1 Answer 1

1

I've executed my app without phonegap only in APACHE SERVER and It was all OK.

I will continue looking for what the problem

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.