在AngularJs中解析Json数据中的对象和数组

时间:2016-08-18 18:05:43

标签: angularjs json

我正在尝试使用我从后端服务使用angularjs获得的数据来构建对象数组。以下是我获取数据的方法

File "C:\Users\Administrator\Desktop\test.py", line 377, in <module>
    easygui.fileopenbox()
  File "C:\Python27\lib\site-packages\easygui\boxes\fileopen_box.py", line 103, in fileopenbox
    func = ut.tk_FileDialog.askopenfilenames if multiple else ut.tk_FileDialog.askopenfilename
AttributeError: 'module' object has no attribute 'askopenfilename'

我想解析它,所以我可以将它全部组合在一个对象数组中,如

"mylist": [

   {

    "name": "Test1",
    "moreInfo": {
    "moreInfoText": "More test",
    },

     "companyInfo": {
      "companyNameInfo": "ABC",
      "url": "http://www.google.com",

        }

        },

        {

   "name": "Test2",
   "moreInfo": {
   "moreInfoText": "More test2",
    },

     "companyInfo": {
    "companyNameInfo": "ABC2",
    "url": "http://www.yahoo.com",
        }


        },

        ]

1 个答案:

答案 0 :(得分:0)

试试这个:

'use strict';

angular.module('web', ['restangular', 'ui.router', 'ui.bootstrap'])
  .config(function ($stateProvider, $urlRouterProvider) {
    $stateProvider
    .state('transactions', {
      url: "/",
      templateUrl: "app/main/transactions.html"
    })
    .state('settings', {
      url: "/settings",
      templateUrl: "app/settings/settings.html"
    });
    $urlRouterProvider.otherwise('/');
  });
;