In my application, I am making a $http request to an API which returns an object representing a user.
$scope.profile = $http.get('api/users/' + $stateParams.userId).success(function(data) {
console.log(data);
});
My question is, how can I assign the value of user.username from this object to $scope.profileUsername
?
The data retrieved looks like this when logged in the console...
Object __v: 0 _id: "56a1832a36dc3d0e00c7aa3f" aboutme: "<p>Im the Boss.</p>" additionalProvidersData: Object county: "waterford" created: "2016-01-22T01:17:30.863Z" displayName: "Chris" firstName: "Chris" gender: "male" imageURL: "/modules/users/client/img/profile/saveme-placeholder.png" profileImageURL: "../modules/users/client/img/profile/avatars/2/45.png" provider: "local" roles: Array[2] updated: "2016-02-09T02:55:38.744Z" username: "abcdef" __proto__: Object