Matt Matt - 2 years ago 50
AngularJS Question

I am trying to retrieve data from a JSON file, but I am having trouble retrieving information from a specific property

Here is my JSON file:

"title":"Yahoo! Weather - Ormond Beach, FL, US",
"description":"Yahoo! Weather for Ormond Beach, FL, US",
"lastBuildDate":"Thu, 16 Jun 2016 05:09 PM EDT",
"city":"Ormond Beach",
"country":"United States",
"region":" FL"

This is not all of the code, but it is the part that I am having trouble with.

I am trying to save the location (
Ormond Beach, Fl
) as a variable. I am using this angularjs code and it doesn't seem to work:
$scope.location =;
. There is nothing wrong with the JSON file, as I have retrieved other information much later in the JSON file using
, but, I am having trouble saving
Ormond Beach
as the variable
. Please help me!

Thanks so much!

gyc gyc
Answer Source

There's an intermediate object between location and result which is channel.

Try instead:

$scope.location =;

Then you just need to concatenate and location.region

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download