1

I'm trying to create an app using ionic framework which is angularJS and parse.com. And I would like to get data from parse.com into my app so I use the code.

var Category = Parse.Object.extend("category");
var query = new Parse.Query(Category);
query.find({
  success: function(results) {
    $scope.category = results;
  },
  error: function(error) {
    alert("Error: " + error.code + " " + error.message);
  }
});

and in HTML page I put

<a ng-repeat="cat in category" nav-clear menu-close class="item" href="#/app/board/{{cat.id}}">
                {{cat.name_en}}
            </a>

to repeat my data.

the results data is

        [{"name_en":"property","name_th":"บ้าน/อพาร์ทเม้นท์","objectId":"tomiG6VzCd","createdAt":"2014-08-18T08:32:13.956Z","updatedAt":"2014-08-18T08:32:19.617Z"},{"name_en":"jobs","name_th":"หางาน/จ้างงาน","objectId":"9Aop8vzn6l","createdAt":"2014-08-18T08:32:32.792Z","updatedAt":"2014-08-18T08:32:36.485Z"},{"name_en":"motors","name_th":"ซื้อ/ขายรถยนต์","objectId":"vLwjhWVJOm","createdAt":"2014-08-18T08:32:55.475Z","updatedAt":"2014-08-18T08:32:58.610Z"},{"name_en":"other","name_th":"อื่นๆ","objectId":"6xVpnrSMrW","createdAt":"2014-08-18T08:33:08.178Z","updatedAt":"2014-08-18T08:33:13.453Z"}]

but when I ten the app, it seem like information doesn't show on the list, so my app displayed like this picture.

enter image description here

like they and see how many rows from parse.com but they can't get name_en to show on the list.

any suggestion to fix this problem.

Thank you.

1

2 Answers 2

0

The success and error callbacks are executed in the context of the Parse library, so Angular is not made aware of the changes on $scope.category. Try to use $scope.$apply to make Angular aware of the change:

success: function(results) {
    $scope.$apply(function () {
        $scope.category = results;
    });
},
Sign up to request clarification or add additional context in comments.

1 Comment

still doesn't work. when I change from {{cat.name_en}} to {{cat.id}} they shows the id of each list but just doesn't work for other attribute.
-1

In your Html, instead of

{{cat.name_en}}

put

{{cat.get('name_en')}}

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.