2017-08-23 3 views
1

でNGリピートを使用して、表内の表Iはangularjsに新しいですし、web-development .Iはこのように、複雑なテーブル内のデータを表現するためにNGリピートを使用しています:angularjs

A  B C  D 
abc pqr xyz std 

だから、これはコード:今すぐ

{ 
     "type": "report", 
     "id": 14, 
     "attributes": { 
      "annotation": "abc", 
      "field": "pqr", 
      "message": "xyz", 
      "score": "7" 
     }, 
     "innerAnnotations": { 
      { 
       "annotation": "jkl", 
       "field": "pqr", 
       "message": "xyz", 
       "score": "6" 
      }, 

      { 
       "annotation": "Qualification", 
       "field": "EFG", 
       "message": "HIJ", 
       "score": "5" 
      } 

     } 
    }, 

表S:

<div class="table-responsive"> 
      <table class="table table-striped table-bordered report-table table-fixed" contextmenu-container="meta.contextmenu" fixed-header> 
      <thead class="text-center text-info"> 
       <th class="text-center">A</th> 
       <th class="text-center">B</th> 
       <th class="text-center">C</th> 
       <th class="text-center">D</th> 
      </thead> 
      <tr ng-repeat="report in reports.data"> 
       <td class="text-center">{{ report.attributes.annotation }}</td> 

       <td class="td-report-field" contenteditable="{{enableReportEditing}}" contextmenu-item="report" context-menu="menuOptions">{{ report.attributes.field }}</td> 
       <td> 
       <input type="checkbox" ng-if="report.attributes.message && showcheckbox" ng-bind="report.attributes.message" ng-click="getcheckedData(report.attributes.message)"> 
       <span ng-if="report.attributes.message" contentEditable ng-model="report.attributes.message"> 
         {{ report.attributes.message }} 
        </span> 
       <span ng-if="!report.attributes.message">{{ report.attributes.message }}</span> 
       </td> 
       <td class="text-center">{{ report.attributes.score }}</td> 
      </tr> 
      </table> 
     </div> 

そしてjsonは次のようです(abcは親になります)

A    B C  D 
abc   pqr xyz 7 
jkl   pqr xyz 6 
Qualification EFg Hij 5 

私はいくつかのことを試みましたが運はありません。いずれか1つ私はこれを解決するのを助けることができますか?どんな助けも素晴らしいでしょう。

+0

コンソールにエラーがありますか? –

+0

何が問題なのですか?すべてのデータが正しく印刷されています。 – Vivz

+1

これは無効なjsonです。 'innerAnnotations'プロパティは配列オブジェクトを持つ必要があります。 –

答えて

0

あなたは NG・リピート= "reports.innerAnnotationsでレポート" と交換してください "reports.dataのレポート" NGリピート

NG・リピート=

に間違ったデータを記載しています。また、内側のhtml角式も変更する必要があります。

+0

しかし、レポートデータも表示する必要があります。 –

+0

完全なJSON構造体を置くことはできますか?私はあなたが部分的にそれを述べたと信じています。 – Sam