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!.
Angular – Get data into ng-Model from object in controller Example
[php]
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)
}
[/php]
How to fetch data from array of objects in angularJS Examples
[php]
$scope.datasource.datavalues.album.forEach(function(param) {
console.log(param.data.name)
})
[/php]
Script File
[php]
.controller(‘liveCtrl’, [‘$scope’, ‘$http’, function ($scope, $http) {
$scope.users = [];
$http
.get(“/api/infinityknow/admin/data.json”)
.then(function(result){
$scope.users = result.data.users;
});
}])
[/php]
HTML part
[php]
users 1
{{users[0].user}}
{{users[0].profile[0]}}
{{users[0].profile[1]}}
[/php]
HTML Part
[php]
users 1
{{users[0].user}}
profile 1
{{users[0].profile[0].value}}
{{users[0].profile[0].profile}}
profile 2
{{users[0].profile[1].value}}
{{users[0].profile[1].profile}}
[/php]
Return object from AngularJS $http get
[php]
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 +
“
status: ” + status +
“
headers: ” + jsonFilter(header) +
“
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 +
“
Data status code: ” + status +
“
Data headers code: ” + header +
“
Data config code: ” + config;
});
};
});
[/php]
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.