{"id":3320,"date":"2015-05-04T12:15:03","date_gmt":"2015-05-04T09:15:03","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=3320"},"modified":"2017-12-19T16:51:55","modified_gmt":"2017-12-19T14:51:55","slug":"angular-js-json-fetching-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/","title":{"rendered":"Angular.js JSON Fetching Example"},"content":{"rendered":"<p>Hello there! Today&#8217;s example&#8217;s about displaying data from a <a href=\"http:\/\/json.org\/\" target=\"_blank\">JSON<\/a> file to an Angular.js application.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;LXJcMJZXSsqGXYW8&#8242;]<\/p>\n<h2>1. Introduction<\/h2>\n<h3>1.1 What is JSON<\/h3>\n<p>JSON is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers.<\/p>\n<p>It is built on two structures:<\/p>\n<ul>\n<li>A collection of name\/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.<\/li>\n<li>An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.<\/li>\n<\/ul>\n<h3>1.2 Example&#8217;s concept<\/h3>\n<p>In this example we will demonstrate a simple way to retrieve a <code>JSON<\/code> file and display the respective information to our Angular application, in a user-friendly way. Specifically, we &#8216;ll here deal with countries&#8217; population around the world.<\/p>\n<h4>1.2.1 The JSON file<\/h4>\n<p>I have already prepared a <b><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/country_codes.zip\" target=\"_blank\">countries json file<\/a><\/b>, which provides codenames and population data for several countries around the world, like this:<\/p>\n<h4>1.2.2 The app itself<\/h4>\n<p>So, what&#8217;s the plan?<\/p>\n<ol>\n<li>Fetch the <code>JSON<\/code>.<\/li>\n<li>Display <code>JSON<\/code>&#8216;s information in a more human-readable way.<\/li>\n<\/ol>\n<p>Fetching the <code>JSON<\/code> at first, means that this has to be done each time the app is being loaded to the browser. That is, the corresponding action will take place into the <code>head<\/code>&#8216;s script.<\/p>\n<p>Ok, that was the easy part, what about the difficult one? The fore-mentioned &#8220;action&#8221; is actually a call to the <code><a href=\"https:\/\/docs.angularjs.org\/api\/ng\/service\/$http\" target=\"_blank\">$http<\/code><\/a> service, a core Angular service that facilitates communication with the remote HTTP servers via the browser&#8217;s <code><a href=\"https:\/\/developer.mozilla.org\/en\/xmlhttprequest\" target=\"_blank\">XMLHttpRequest<\/code><\/a> object or via <code><a href=\"http:\/\/en.wikipedia.org\/wiki\/JSONP\" target=\"_blank\">JSONP<\/a><\/code>.<\/p>\n<p><b><i>Practically, this means that you have to deploy your app in a web server, rather than executing it in a browser. For further details about this fact, please consult <a href=\"http:\/\/thodorisbais.blogspot.gr\/2015\/03\/how-to-solve-failed-to-execute-send-on.html\" target=\"_blank\">this post<\/a>.<\/i><\/b><\/p>\n<p>The general usage of the <code>$http<\/code> service is a single argument (configuration object) that is used to generate an HTTP request. It returns a <a href=\"https:\/\/docs.angularjs.org\/api\/ng\/service\/$q\" target=\"_blank\">promise<\/a> with two <code>$http<\/code> methods: <code>success<\/code> and <code>error<\/code>.<\/p>\n<p>Here&#8217;s how a simple <code>GET<\/code> request looks like:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\/\/ Simple GET request example :\r\n$http.get('\/someUrl').\r\n  success(function(data, status, headers, config) {\r\n    \/\/ this callback will be called asynchronously\r\n    \/\/ when the response is available\r\n  }).\r\n  error(function(data, status, headers, config) {\r\n    \/\/ called asynchronously if an error occurs\r\n    \/\/ or server returns response with an error status.\r\n  });\r\n<\/pre>\n<p><i>We&#8217;ll only make use of the <code>success<\/code> and guess what?! On service&#8217;s successful call\/execution, we want to load our <code>JSON<\/code> file into a global variable, in order to be accessible all over the app and yes, your guess was right, <code><a href=\"https:\/\/docs.angularjs.org\/guide\/scope\" target=\"_blank\">$scope<\/a><\/code> is the global variable that we &#8216;re searching for!<\/i><\/p>\n<p>In addition, the <code>$http<\/code> core service, provides shortcut methods, where the only requirement  is the URL that has to be processed, whereas the request data must be passed in for POST\/PUT requests:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n$http.get('\/someUrl').success(successCallback);\r\n<\/pre>\n<h2>2. The Example<\/h2>\n<p>Time for action!<\/p>\n<h3>2.1 Loading JSON into $scope<\/h3>\n<p>According to the fore-mentioned notes, we have to load our JSON file into a <code>$scope<\/code> variable, let&#8217;s say &#8220;countries&#8221;:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n$http.get('countries.json').success(function(data) {\r\n    $scope.countries = data;\r\n});\r\n<\/pre>\n<p>Obviously, this service call has to be a part of an Angular&#8217;s app controller definition, so, assuming that we named our angular app as &#8220;countryApp&#8221;, here&#8217;s the updated format of our service call:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\ncountryApp.controller('CountryCtrl', function ($scope, $http) {\r\n   $http.get('countries.json').success(function(data) {\r\n       $scope.countries = data;\r\n   });\r\n});\r\n<\/pre>\n<p><i>If you need further assistance according to Angular Controllers, please take a look at <a href=\"http:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-controller-example\/\" target=\"_blank\">this<\/a> post.<\/i><\/p>\n<h3>2.2 Displaying JSON data into a table<\/h3>\n<p>Now that we &#8216;ve loaded all the JSON&#8217;s data into <code>$scope.countries<\/code>, let&#8217;s display them to a table with three columns: code, name, population. This fact is translated into two requirements:<\/p>\n<ol>\n<li>We have to find a way to repeatedly parse all the data from <code>$scope.variables<\/code> (as we obviously don&#8217;t want to exercise our handwriting for more than 70 separate countries).<\/li>\n<li>We want to divide each country&#8217;s data, into code, name and population, in order to display each one in the corresponding table&#8217;s column<\/li>\n<\/ol>\n<p>Defining the table&#8217;s headers is very easy:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;tr&gt;\r\n\t&lt;th&gt;Code&lt;\/th&gt;\r\n\t&lt;th&gt;Country&lt;\/th&gt;\r\n\t&lt;th&gt;Population&lt;\/th&gt;\r\n&lt;\/tr&gt;\r\n<\/pre>\n<p>Now, to fullfil the first requirement, we &#8216;ll use Angular&#8217;s <code><a href=\"https:\/\/docs.angularjs.org\/api\/ng\/directive\/ngRepeat\" target=\"_blank\">ngRepeat<\/a><\/code> directive, which instantiates a template once per item from a collection. Each template instance gets its own scope, where the given loop vriable is set to the current location item, and <code>$index<\/code> is set to the item index or key.<\/p>\n<p>In our case, to repeatedly loop over each country, we have to assume that each country is a table row:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\">\r\n&lt;tr ng-repeat=\"country in countries\"&gt;\r\n\r\n&lt;\/tr&gt;\r\n<\/pre>\n<p>Fullfilling the second requirement is now easier, that the country processed each time can be accessed from the <code>country<\/code> variable:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\">\r\n&lt;tr ng-repeat=\"country in countries | orderBy: 'code' \"&gt;\r\n\t&lt;td&gt;{{country.code}}&lt;\/td&gt;\r\n\t&lt;td&gt;{{country.name}}&lt;\/td&gt;\r\n\t&lt;td&gt;{{country.population}}&lt;\/td&gt;\r\n&lt;\/tr&gt;\r\n<\/pre>\n<p>Here is the final structure of our app:<\/p>\n<p><u><code>index.html<\/code><\/u><\/p>\n<pre class=\"brush: xml; title: ; notranslate\">\r\n&lt;html ng-app=\"countryApp\"&gt;\r\n  &lt;head&gt;\r\n    &lt;meta charset=\"utf-8\"&gt;\r\n    &lt;title&gt;Angular.js JSON Fetching Example&lt;\/title&gt;\r\n    &lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.2\/css\/bootstrap.min.css\"&gt;\r\n\t&lt;script src=\"http:\/\/ajax.googleapis.com\/ajax\/libs\/angularjs\/1.2.26\/angular.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script&gt;\r\n      var countryApp = angular.module('countryApp', []);\r\n      countryApp.controller('CountryCtrl', function ($scope, $http){\r\n        $http.get('countries.json').success(function(data) {\r\n          $scope.countries = data;\r\n        });\r\n      });\r\n    &lt;\/script&gt;\r\n  &lt;\/head&gt;\r\n  &lt;body ng-controller=\"CountryCtrl\"&gt;\r\n\t&lt;h2&gt;Angular.js JSON Fetching Example&lt;\/h2&gt;\r\n    &lt;table&gt;\r\n      &lt;tr&gt;\r\n        &lt;th&gt;Code&lt;\/th&gt;\r\n\t\t&lt;th&gt;Country&lt;\/th&gt;\r\n        &lt;th&gt;Population&lt;\/th&gt;\r\n      &lt;\/tr&gt;\r\n      &lt;tr ng-repeat=\"country in countries | orderBy: 'code' \"&gt;\r\n        &lt;td&gt;{{country.code}}&lt;\/td&gt;\r\n\t\t&lt;td&gt;{{country.name}}&lt;\/td&gt;\r\n        &lt;td&gt;{{country.population}}&lt;\/td&gt;\r\n      &lt;\/tr&gt;\r\n    &lt;\/table&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<h2>3. Demo<\/h2>\n<p>Let&#8217;s run it in a <a href=\"http:\/\/thodorisbais.blogspot.gr\/2015\/03\/how-to-solve-failed-to-execute-send-on.html\" target=\"_blank\">local server<\/a>.<\/p>\n<figure id=\"attachment_3606\" aria-describedby=\"caption-attachment-3606\" style=\"width: 570px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/app.png\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/app.png\" alt=\"Figure 1. App screenshot\" width=\"570\" height=\"451\" class=\"size-full wp-image-3606\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/app.png 570w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/app-300x237.png 300w\" sizes=\"(max-width: 570px) 100vw, 570px\" \/><\/a><figcaption id=\"caption-attachment-3606\" class=\"wp-caption-text\">Figure 1. App screenshot<\/figcaption><\/figure>\n<h2>4. Download<\/h2>\n<p>This was an example of Angular.js JSON Fetching.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>You can download the full source code of this example here : <a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/angularjs_json_fetching1.zip\"><strong>angularjs_json_fetching.zip<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello there! Today&#8217;s example&#8217;s about displaying data from a JSON file to an Angular.js application. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [ulp id=&#8217;LXJcMJZXSsqGXYW8&#8242;] 1. Introduction 1.1 What is JSON JSON is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse &hellip;<\/p>\n","protected":false},"author":63,"featured_media":909,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[40],"class_list":["post-3320","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-angular-js","tag-json"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Angular.js JSON Fetching Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"Hello there! Today&#039;s example&#039;s about displaying data from a JSON file to an Angular.js application. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Angular.js JSON Fetching Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"Hello there! Today&#039;s example&#039;s about displaying data from a JSON file to an Angular.js application. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/toubou.techblog\/\" \/>\n<meta property=\"article:published_time\" content=\"2015-05-04T09:15:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-12-19T14:51:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Thodoris Bais\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ThodorisBais\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Thodoris Bais\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/\"},\"author\":{\"name\":\"Thodoris Bais\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/f622d6017801d9aa8131e1ae69bbdd0d\"},\"headline\":\"Angular.js JSON Fetching Example\",\"datePublished\":\"2015-05-04T09:15:03+00:00\",\"dateModified\":\"2017-12-19T14:51:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/\"},\"wordCount\":838,\"commentCount\":13,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"keywords\":[\"JSON\"],\"articleSection\":[\"Angular.js\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/\",\"name\":\"Angular.js JSON Fetching Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"datePublished\":\"2015-05-04T09:15:03+00:00\",\"dateModified\":\"2017-12-19T14:51:55+00:00\",\"description\":\"Hello there! Today's example's about displaying data from a JSON file to an Angular.js application. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Angular.js\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/angular-js\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Angular.js JSON Fetching Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/f622d6017801d9aa8131e1ae69bbdd0d\",\"name\":\"Thodoris Bais\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/dc31ee119255c1e4aa4a4f34858284d907cce53d033584d86b0e3de46db7d0ff?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/dc31ee119255c1e4aa4a4f34858284d907cce53d033584d86b0e3de46db7d0ff?s=96&d=mm&r=g\",\"caption\":\"Thodoris Bais\"},\"description\":\"Thodoris is an Oracle Certified Associate Java Programmer and currently works as a Junior Software Developer, for Intrasoft International S.A. He holds a diploma at Informatics &amp; Telecommunications Engineering and is interested in continuous development.\",\"sameAs\":[\"http:\/\/thodorisbais.blogspot.com\",\"https:\/\/www.facebook.com\/toubou.techblog\/\",\"https:\/\/instagram.com\/thodoris.bais\/\",\"https:\/\/www.linkedin.com\/pub\/thodoris-bais\/69\/6b7\/408\",\"https:\/\/x.com\/@ThodorisBais\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/thodoris-bais\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Angular.js JSON Fetching Example - Web Code Geeks - 2026","description":"Hello there! Today's example's about displaying data from a JSON file to an Angular.js application. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/","og_locale":"en_US","og_type":"article","og_title":"Angular.js JSON Fetching Example - Web Code Geeks - 2026","og_description":"Hello there! Today's example's about displaying data from a JSON file to an Angular.js application. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_author":"https:\/\/www.facebook.com\/toubou.techblog\/","article_published_time":"2015-05-04T09:15:03+00:00","article_modified_time":"2017-12-19T14:51:55+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","type":"image\/jpeg"}],"author":"Thodoris Bais","twitter_card":"summary_large_image","twitter_creator":"@ThodorisBais","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Thodoris Bais","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/"},"author":{"name":"Thodoris Bais","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/f622d6017801d9aa8131e1ae69bbdd0d"},"headline":"Angular.js JSON Fetching Example","datePublished":"2015-05-04T09:15:03+00:00","dateModified":"2017-12-19T14:51:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/"},"wordCount":838,"commentCount":13,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","keywords":["JSON"],"articleSection":["Angular.js"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/","name":"Angular.js JSON Fetching Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","datePublished":"2015-05-04T09:15:03+00:00","dateModified":"2017-12-19T14:51:55+00:00","description":"Hello there! Today's example's about displaying data from a JSON file to an Angular.js application. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/angular-js-json-fetching-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"Angular.js","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/angular-js\/"},{"@type":"ListItem","position":4,"name":"Angular.js JSON Fetching Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/f622d6017801d9aa8131e1ae69bbdd0d","name":"Thodoris Bais","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/dc31ee119255c1e4aa4a4f34858284d907cce53d033584d86b0e3de46db7d0ff?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dc31ee119255c1e4aa4a4f34858284d907cce53d033584d86b0e3de46db7d0ff?s=96&d=mm&r=g","caption":"Thodoris Bais"},"description":"Thodoris is an Oracle Certified Associate Java Programmer and currently works as a Junior Software Developer, for Intrasoft International S.A. He holds a diploma at Informatics &amp; Telecommunications Engineering and is interested in continuous development.","sameAs":["http:\/\/thodorisbais.blogspot.com","https:\/\/www.facebook.com\/toubou.techblog\/","https:\/\/instagram.com\/thodoris.bais\/","https:\/\/www.linkedin.com\/pub\/thodoris-bais\/69\/6b7\/408","https:\/\/x.com\/@ThodorisBais"],"url":"https:\/\/www.webcodegeeks.com\/author\/thodoris-bais\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/3320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=3320"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/3320\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/909"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=3320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=3320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=3320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}