Angularjs Get data from array of objects in controller

Angularjs Get data from array of objects in controller

Also Read : first love marriage in the world

Angularjs Get data from array of objects in controller

In this Post We Will Explain About is Angularjs Get data from array of objects in controller With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to How to Display single object data with out Using ng-repeat Example

In this post we will show you Best way to implement Return object from AngularJS $http get, hear for How to access JSON array object in HTML using angularwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

READ :  Vuejs Router pass url parameters Synchronize

Angular – Get data into ng-Model from object in controller Example

function ajaxjsoncall(callback) {
    $http({
        url: '/api/infinityknow/admin/productslist.php',
        method: "GET",
        params: { userID: ClId }
    }).success(function (data) {
        callback(data);
    });
}

function somejsFunctionnewCallback(data) {
    console.log(data) 
}

How to fetch data from array of objects in angularJS Examples

$scope.datasource.datavalues.album.forEach(function(param) {

    console.log(param.data.name)
})

Script File

.controller('liveCtrl', ['$scope', '$http', function ($scope, $http) { 
  $scope.users = [];
  $http
    .get("/api/infinityknow/admin/data.json")
    .then(function(result){
      $scope.users = result.data.users;
    });
}]) 

Also Read : tamilblasters, 9kmovie, filmygod, hdhub4u, vegamovies, tamilrockers website link and 1377x proxy.

HTML part

<div class="main-content">
  <div id="Content1">
  <h1>users 1</h1>
  <p>{{users[0].user}}</p>
  <p>{{users[0].profile[0]}}</p>
  <p>{{users[0].profile[1]}}</p>
  </div>
</div>

HTML Part

<h1>users 1</h1>
<p>{{users[0].user}}</p>
<h2>profile 1</h2>
<p>{{users[0].profile[0].value}}</p>
<p>{{users[0].profile[0].profile}}</p>
<h2>profile 2</h2>
<p>{{users[0].profile[1].value}}</p>
<p>{{users[0].profile[1].profile}}</p>

Return object from AngularJS $http get

    var liveapp = angular.module("liveapp", []);
    liveapp.controller("liveCtrl", function ($scope, $http) {
        
        $scope.mykeywords = '';

        $scope.GetAllData = function () {
            $http.get('/api/infinityknow/admin/getdata.php')
            .success(function (data, status, headers, config) {
                $scope.persondetails = data;
            })
            .error(function (data, status, header, config) {
                $scope.ResponseDetails = "Data: " + data +
                    "<br />status: " + status +
                    "<br />headers: " + jsonFilter(header) +
                    "<br />config: " + jsonFilter(config);
            });
        };

        $scope.SearchData = function () {

            var myparam = {
                mykeywords: $scope.mykeywords
            };
            var config = {
                params: myparam
            };

            $http.get('/api/infinityknow/admin/getproject.php', config)
            .success(function (data, status, headers, config) {
                $scope.persondetails = data;
            })
            .error(function (data, status, header, config) {
                $scope.ResponseDetails = "Data: " + data +
                    "<br />Data status code: " + status +
                    "<br />Data headers code: " + header +
                    "<br />Data config code: " + config;
            });
        };

    });

Example

READ :  Set textarea directive value in Angular

I hope you have Got What is How to fetch data from array of objects in angularJS? And how it works.I would Like to have FeadBack From My Blog(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.