0

having problem in mobile view no data receive in angularjs.. desktop view is working great.. what's the best solution for this sorry not good in english......................................... ..................................................................

PHP file

<body ng-app="app" ng-controller="fcontrol">


<div ng-repeat="person in people">
{{person.fname}}
{{person.lname}}
{{person.email}}
{{person.address}}

</div>

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.20/angular.min.js"></script>
<script src="js/control.js"></script>

</body>



Angularjs(control.js)

angular.module("app" , []);

function fcontrol($scope, $http) {

    $http.get("http://localhost:8000/users")
      .success(function(data) {
       $scope.people = data;

     })


}



Nodejs

app.get('/users', function(req, res) {

      var s = 'SELECT * FROM tbl_user order by fname';

      dbconn.query(s, function(err, rows, fields) {
         var row = [];

         if (err) throw err;
           //console.log(rows)
           res.send(rows);
           res.end();
      });


  });

1 Answer 1

0

Try chaging your http get url in angular JS code to YOUR IP:8000/users.(Replace localhost with your system IP). Also make sure your mobile and PC should connected to same network.(If your IP is not public)

Angularjs(control.js)

angular.module("app" , []);

function fcontrol($scope, $http) {

    $http.get("http://<your ip>:8000/users")
      .success(function(data) {
       $scope.people = data;

     })


}
1
  • thank you for the response...i forgot angularjs is client side..thanks again Commented Aug 23, 2014 at 4:43

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.