<input type="text" ng-model="displayName"/>
<h2>Country</h2>
<select ng-model="country">
+ <option value="NULL">Unspecified</option>
<option value="United States">United States</option>
<option value="United Kingdom">United Kingdom</option>
<option value="Afghanistan">Afghanistan</option>
UserService.getCurrentUser().then(function(user)
{
console.log(user);
- $scope.country = user.country;
+ $scope.country = user.country ? user.country : "NULL";
$scope.displayName = user.displayName;
});
$scope.ok = function()
{
- var update = {displayName:$scope.displayName, country:$scope.country};
+ var update = {displayName:$scope.displayName};
+
+ if($scope.country !== "NULL")
+ {
+ update.country = $scope.country;
+ } else {
+ update.country = null;
+ console.log(update);
+ }
+
UserService.updateCurrentUser(update).
then(function(result)
{