Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49169

How display $scope.User data in console?

$
0
0

@DavidLoevy wrote:

in controller I have code:

.controller('MyAccountCtrl', function($scope,$http,BaseURL,$localStorage) {
var OnUserComplete=function(response) {
$scope.User=response.data;
}
$BuddyID=$localStorage.get('BuddyName');
$TempURL='/API/User/'+$BuddyID;
$http.get(BaseURL.concat($TempURL))
.then(OnUserComplete);
console.log($scope.User.User[0].CC); /* how can display value "$scope.User.User[0].CC"??? */
})

I try "$scope.User.User[0].CC", "$User.User[0].CC", "$scope.User.CC", ... but no success.
I have error "Cannot read property 'User' of undefined" or "undefined" (or similar).
But if I use:

console.log($scope)

it display whole "scope" object, including "User", "User[0]" and its atributtes "CC" also.
But I need having dispaly only "CC" value.
Pls some tips or ideas?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49169

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>