UPDATE: Find working version of your fiddle here: https://jsfiddle.net/h4od21fs/1/
So you have number of issues here:
as others have said Parse and angular doesn't know about each other without angular plugin, so in your case you need to call $scope.$apply() after you got data
you have handlebars plugged in together with angular and have total mess with layout
you can't just use object that parse returns you, it returns you active record so you need to call methods to get actual data from it , i.e. :
vm.results.price = results.get('price')
and in your fiddle you did not include angular.js, but included a lot of other stuff , like bootstrap, handlebars and jquery.
also don't forget to change key in parse.com so no one would use your quotas.
Resulting code:
var app = angular.module('myApp',[]);
app.run(function() {
Parse.initialize("Clfupzjbt9iWIdezPCZuBJqajuxHJ8okP5nteViS", "sakt1qjwM4duTAo3ZCvWWBM32Tv3ZdL13PQ0Eea4");
});
var currentTime = new Date();
currentTime = new Date(currentTime.getTime() - 25200000);
app.controller('membershipCtrl', ['$scope', function($scope) {
var vm = this;
vm.results = null;
var membership = Parse.Object.extend("Membership");
var query = new Parse.Query(membership);
//query.ascending("priceDate").greaterThan('priceDate', currentTime).limit(1);
// i commented it out as it was not returning any data with those conditions
query.first({
success: function(results) {
vm.results = {
price : results.get('price'),
priceDescription: results.get('priceDescription')
};
$scope.$apply();
console.log(vm);
},
error: function(error) {
alert("Error: " + error.code + " " + error.message);
}
});
}]);
When you are doing $scope = smooth inside controller you are not changing scope, but rather changing variable assigned to $scope argument of your controller function. As it is passed as reference, it would not affect $scope object that was passed into controller.
You should add property on the scope instead, or to controller itself if you are using ControllerAs syntax, i.e. for $scope:
$scope.results = results // inside your success callback
For controllerAs syntax:
app.controller('membershipCtrl', ['$scope', function($scope) {
var vm = this;
var membership = Parse.Object.extend("Membership");
var query = new Parse.Query(membership);
query.ascending("priceDate").greaterThan('priceDate', currentTime).limit(1);
query.first({
success: function(results) {
vm.results = results;
console.log(vm);
},
error: function(error) {
alert("Error: " + error.code + " " + error.message);
}
});
}]);
And in html:
<div ng-app="myApp" ng-controller="membershipCtrl as vm">
{{vm.results.price}}{{vm.results.priceDescription}}
</div>
$scope, you are overwriting the$scope. This could cause the app to no longer recognize the$scopeas an instance of the correct prototype chain. Try$scope.price = results.price; $scope.priceDescription = results.priceDescription;and see if that works.console.log?