Created
October 1, 2015 15:41
-
-
Save RubyRonin/08cd20380c0b5086eee0 to your computer and use it in GitHub Desktop.
how do I use apply() to update scope see line 26 isn't working
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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,{ | |
// alternatively try Parse.User.current().save.then(function(){$scope.$apply();}); | |
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