Reading data from JSON file in Angularjs

Hai i am new in Angularjs. I am trying to read data from JSON file, But it returns a strange output. Here is my controller.js file

      console.log("DATA FROM JSON:",$scope.friends);


Here is my services.js file


   return {

            console.log("inside function");
            return [



console output is

0: Object
length: 1
__proto__: Array[0

Please help.

AngularJS $http reading JSON data

How can i display data from an array of JSON data returned from the server in AngularJS? This is what i have, and for some reason i cannot display any data on my html page: <script> function pla

unable to fetch data from json file in angularjs?

I’m new in angularjs,i’m trying to load data from my json file on view. json file have some list of patients. But does not get showed on my view here is my ‘patient.json’ file [ { id: 0, first_name

How to get table data from json file in angularjs

I want to get data from a JSON file using angularjs or jquery. The following code is not working, I cannot find the mistake: JSFIDDLE html: <head> <script [email protected]* data-se

How to read JSON data from same json for tree layout insteadof reading from other .JSON file?

how to read JSON data from same .js file instead of reading it from other .JSON file currently I am using : d3.json(network.json, function(error, treeData){ // tree layout logic goes here } instea

Filter data with AngularJS from JSON file

I am creating a word of the day functionality in a web app and I have a JSON file with the following data structure. I couldn’t get myself to dump 730+ entries into the HTML under ng-init to filter

Reading JSON file from R

I try reading a JSON file from R using rjson but keep getting errors. I validated the JSON file using various online validators. Here is the content of the JSON file: { scenarios: [ { files: { ty

Reading data from JSON file with Python

I have a datra structure like this: 37_7009: [ { viewport_dimensions: {width: 1583, height: 798}, mouse_position: {y: 1147, x: 841}, node_data_attrs: {groupid: id_FW13-e052-7009-08

AngularJS reading JSON from Spring REST API

I’m new to AngularJS and I’m migrating an existing Spring MVC based web app over to it. The great thing is I am removing a lot of JS that was manipulating the JSON returned from the Spring controller(

unable to load data from local json file via angularJS inside jquery mobile app

Im trying to load some data from a local json file and put it inside a jquery mobile listview using angularJS. Im having a hard time to understand how do I combine the ng-repeat with the data-role=li

Getting data from JSON url using angularJS

I am really new to using AngularJS and Javascript. I need to get the totalResults data from a JSON source that looks like this: { queries: { request: [ { totalResults: 51 } ] } } Once I get


$http.get returns a promise and you’re returning an array containing that promise.

Do this instead:

.module('', [])
.factory('Friend', function ($http) {
    return {
        get: function () {
            console.log("inside function");
            return $http.get('/api/get.json');

Then use your factory this way:

.module('app.controllers', [''])
.controller('yourCtrl', function ($scope, Friend) {
    Friend.get().then(function (msg) {
        $scope.msg = msg;