Created
January 13, 2015 15:59
-
-
Save terakilobyte/4fbcfd1db617b7df8f8a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* Angular API Call | |
*/ | |
exports.getAccountAngular = function(req, res) { | |
Challenge.find({}, null, { sort: { challengeNumber: 1 } }, function(err, c) { | |
if (err) { | |
console.error('Challenge err: ', err); | |
next(err); | |
} | |
res.json({ | |
user: req.user | |
}); | |
}); | |
}; | |
/** | |
* Async user data request | |
*/ | |
profileValidation.controller('profileValidationController', ['$scope', '$http', | |
function($scope, $http) { | |
$http.get('/account/api').success(function(data) { | |
$scope.user = data.user; | |
$scope.user.profile.username = $scope.user.profile.username ? $scope.user.profile.username.toLowerCase() : undefined; | |
$scope.storedUsername = data.user.profile.username; | |
$scope.storedEmail = data.user.email; | |
$scope.user.email = $scope.user.email ? $scope.user.email.toLowerCase() : undefined; | |
$scope.user.profile.twitterHandle = $scope.user.profile.twitterHandle ? $scope.user.profile.twitterHandle.toLowerCase() : undefined; | |
$scope.asyncComplete = true; | |
}); | |
} | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment