API Controls API Controls - 1 month ago 4
AngularJS Question

call a value in anguarjs

I want to call a particular value in my app through angularjs

here is my controller(js file)

//infocomnamebyid
$http.get('/csuv5.asmx/infocomname', {
params: {
id: $scope.additionalinfoparam.Id
}
})
.then(function (response) {
{
$scope.comnamebyinfo = response.data.info;
console.log(response.data.info);
}
});
}


the value is printing in console like this

[Object]
0
:
Object
comname
:
"QED Productions Pvt Ltd"
__proto__
:
Object
length
:
1
__proto__
:
Array[0]


but now i want to print the same on my label

<label></label>

Answer

Try JSON.parse()

 $scope.comnamebyinfo = JSON.parse(response.data.info);

and in HTML,

 <label ng-model="comnamebyinfo"></label>