javascript - How can i get values from this $scope using angularjs? -


i getting selecteditems in console

[{"model":"lumia","brand":"nokia","submodel":["lumia 735 ts","lumia 510"],"city":"bangalore"}]  

i stoed in $scope.details var selecteditems = $location.search().items; $scope.details =[{"model":"lumia","brand":"nokia","submodel":["lumia 735 ts","lumia 510"],"city":"bangalore"}]

how can model , brand , submodel city in above variable

my expectation :

i have put not getting value

console.log($scope.details.model); 

i should lumia

console.log($scope.details.brand); 

i should nokia

console.log($scope.details.submodel); 

i should "lumia 735 ts","lumia 510"

since $scope.details array, have use index object contains properties want access.

$scope.details[0].model $scope.details[0].brand; $scope.details[0].submodel; 

this means accessing first object in array , property model of object.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -