Iterate through nested json array in angular controller and get unique values

前端 未结 5 677
Happy的楠姐
Happy的楠姐 2020-12-31 08:17

I need to iterate through nested json array which looks like that

[
  {
    \"title\": \"EPAM\",
    \"technologies\": [
        \"PHP\",
        \".net\",
          


        
5条回答
  •  抹茶落季
    2020-12-31 08:59

    Use angular's forEach:

     var app = angular.module('app', []);
        app.controller('CompaniesController', ['$scope', '$http', 
          function($scope, $http) {
            $http.get('json/companies.json').success(function(data) {
                $scope.companies = data; // get data from json
                  angular.forEach($scope.companies, function(item){
                       console.log(item.technologies);  
                   })
                });
            });
    
          }
        ]); 
    

提交回复
热议问题