Page 1 of 1

Unable to apply value from API to screen element

Posted: Thu Jun 30, 2016 4:53 am
by ajay.3.sharma

I have created a service to use MYSQL using API Express.
I tired to use this service using BOOTSTRAP and its working fine.
But when I try to use the same in ICONIC app, the API call is successful, but unable to render that value back to the screen object?

Can you help me. Is there something I am missing?
Please find the required screenshots.

Image Image Image Image


Unable to apply value from API to screen element

Posted: Thu Jun 30, 2016 5:49 pm
by Illya Stepanov

Hello -

In your code$scope.get/code function code:

  • on success add -- code$scope.$apply();/code

Unable to apply value from API to screen element

Posted: Thu Jun 30, 2016 6:19 pm
by ajay.3.sharma

Thank you for responding.
Even $scope.$apply(); doesn't help. Still no values on the screen
Is they any way where I am use alert() and see if any value is being fetched from my API response?

I have already tested the API in API express and its working fine.


Unable to apply value from API to screen element

Posted: Thu Jun 30, 2016 6:24 pm
by ajay.3.sharma

Is there something specific with Ionic which I am missing. Its working fine with Bootstrap actually :(


Unable to apply value from API to screen element

Posted: Thu Jun 30, 2016 7:11 pm
by Illya Stepanov

Sure, you can always use the browser developer tools and check the Network tab for an actual response which you getting from your service invocation.


Unable to apply value from API to screen element

Posted: Thu Jun 30, 2016 7:14 pm
by Illya Stepanov

Actually I forgot to mention that you should define Model in your project with such properties for your "user" and actual "id" and after that define your service invocation inside the app and add $scope.$apply();


Unable to apply value from API to screen element

Posted: Thu Jun 30, 2016 7:21 pm
by ajay.3.sharma

Model is defined and it works well in Bootstrap app. My only issue is with Ionic app


Unable to apply value from API to screen element

Posted: Thu Jun 30, 2016 7:22 pm
by ajay.3.sharma

Thanks just saw the browsers developer tools - network tab, the response is sending 5 rows.
I am trying to capture only 1 row result.

How come this issue no come in Bootstrap?

  • More updates +
    The Bootstrap is returning only 1 row, while Ionic call is returning all rows for the same API call.???!!!

    I think its something really basic, which I have not handled?


Unable to apply value from API to screen element

Posted: Thu Jun 30, 2016 8:44 pm
by Illya Stepanov

In this case you haven't passed an id of your requested data. Please check all variables inside your app scope if they are actually getting the corresponding values.