Skip to content

Instantly share code, notes, and snippets.

@RubyRonin
Created October 1, 2015 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RubyRonin/f5adaaf6e89b45ff1f2b to your computer and use it in GitHub Desktop.
Save RubyRonin/f5adaaf6e89b45ff1f2b to your computer and use it in GitHub Desktop.
$scope.apply() isn't updating $scope.user
.controller('DashBoardCtrl', function($scope, $cordovaContacts) {
$scope.user = {};
Parse.User.current().fetch().then(function (user) {
$scope.user.username = user.get('username');
$scope.user.email = user.get('email');
$scope.user.fname = user.get('firstName');
$scope.user.lname = user.get('lName');
$scope.user.draftpick = user.get('draftpick');
});
$scope.contactgrab = function () {
$cordovaContacts.pickContact().then(function (contactPicked) {
$scope.contact = contactPicked;
// Parse.User.current().then(function() {
Parse.User.current().set('draftpick', $scope.contact.displayName);
// });
Parse.User.current().save(null,{
success: function(){
$scope.$apply(); // not yet tested
alert("added");
},
error: function(error){
alert("Error: " + error.code + " " +error.message);
}
});
});
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment