如何使用angular js在html中显示嵌套对象

时间:2019-04-01 06:37:39

标签: json angularjs nested

我正在尝试填充用户名的数量并将其显示为按钮,并且在悬停工具提示上仅需要使用来自json对象的特定数组的用户名进行显示。 下面是json对象

[
    {

      "ID": 114,
      "Title": "AutoZon-Mobile First Implement",
       "AccountName": "AutoZone, Inc",
       "SBU":"RCG-NA",
       "Region": {
         "lookupId": "3",
         "lookupValue": "RCG-CENTRAL"
     },
       "CurrentStatus":"Red",
       "LastStatus":"Red",
       "ProgramManager":
       [
         {
             "userId": "936",
             "userName": "Sathyavakeeswaran, Balakrishnan (Wipro)"
         },
         {
             "userId": "387",
             "userName": "Venkatachari, Srikanth (Infosys)"
         }
      ],
       "EP":"Kumar,Pankh",
       "DP":"Kumar,Pankh"

    },
{

      "ID": 114,
      "Title": "AutoZon-Mobile First Implement",
       "AccountName": "AutoZone, Inc",
       "SBU":"RCG-NA",
       "Region": {
         "lookupId": "3",
         "lookupValue": "RCG-CENTRAL"
     },
       "CurrentStatus":"Red",
       "LastStatus":"Red",
       "ProgramManager":
       [
         {
             "userId": "936",
             "userName": "Sathyavakeeswaran, Balakrishnan (Cognizant)"
         },
         {
             "userId": "387",
             "userName": "Venkatachari, Srikanth (IBM)"
         }
      ],
       "EP":"Kumar,Pankh",
       "DP":"Kumar,Pankh"

    }
]

我需要在一个按钮中显示程序管理器计数,并且悬停时只需要为其中列出的所有名称显示用户名

<span>
    <!--ng-if="showPM"-->
    <button class="pmBtn" ng-repeat="p in x.ProgramManager" uib-tooltip="{{p.userName}}">{{x.ProgramManager.length-1}}+</button>
</span>

期望有一个显示计数值的按钮,并在鼠标悬停时显示json对象中每个列表的用户名

0 个答案:

没有答案