将列表注入json格式

时间:2016-08-13 13:18:36

标签: angularjs json angularjs-controller

我是angularJs的新手,我想注入一个字符串列表,我使用一个宁静的Web服务将其添加到jSON列表中。 连接列表如何继续进行getAllConnectedApp返回的对象。

angular
  .module('theme.core.navigation_controller', ['theme.core.services'])
  .controller('NavigationController', ['$scope', '$location', '$timeout', '$filter', '$http', '$cookieStore', '$interval',
    function($scope, $location, $timeout, filter, $http, $cookieStore, $interval) {
      'use strict';
      $scope.filterOptions = {
        filterText: '',
        useExternalFilter: true
      };
      $scope.connections = [];
      $scope.menu = [{
        label: 'HOME',
        iconClasses: 'glyphicon glyphicon-home',
        url: '#/'
      }, {
        label: 'ORACLE MONITORING',
        iconClasses: 'glyphicon glyphicon-unchecked',
        children: [{
          label: 'SESSIONS',
          url: '#/general'

        }, {
          label: 'ADVANCED MONITORING',
          url: '#/advanced-monitoring'
        }, {
          label: 'CONFIGURATION',
          url: '#/configuration'
        }]
      }, {
        label: 'CODE TRACER',
        iconClasses: 'glyphicon glyphicon-check',
        children: [{
              label: 'ADD CONNECTION',
              url: '#/addConnectionApp'

            },
            for (var i = 0; i < $scope.connections.length; i++) {
              {
                label: $scope.connections[i],
                url: '#/codetracer',

              }
            }
          ]
          //url: '#/codetracer'
      }];

      $scope.getAllConnectedApp = function() {
        console.log("GET ALL CONNECTED APPLICATIONS...");
        $http.get("http://localhost:8090/api/personne/allConnection")
          .success(function(connections) {
            console.log(connections);
            $scope.connections = connections;
          });
      };

    }
  ]);

0 个答案:

没有答案