PrimeNG表内的嵌套对象

时间:2019-02-05 21:34:20

标签: angular typescript

我正在尝试实现排序和导出,但是我发现可能需要模板中的数据,例如:

let
    decodeKey: Dict String Value -> Result String a
    decodeKey object =
        case Dict.get key object of
            Just value ->
                parameterAttempt value

            Nothing ->
                Err "couldn't find key"

    attemptToDecode: Value -> Result String a
    attemptToDecode value =
        case value of
            Jobject foundIt ->
                decodeKey foundIt

            _ ->
                Err "not an object"
in
    Decoder attemptToDecode

这是我当前将数据导入的方式:

 <td *ngFor="let col of columns">
    {{rowData[col.field]}}
</td>

由于我的json的结构如下,我将添加更多字段:

  <ng-template pTemplate="body" let-userData="rowData">
      <tr [pSelectableRow]="userData">
        <td><p-tableCheckbox [value]="driverData"></p-tableCheckbox>{{userData.userInfo.first_name}} {{userData.userInfo.last_name}} ({{userData.userInfo.username}})</td>
      <td>{{userData.recommendedAction}}</td>
    </tr>
  </ng-template>

我不太确定如何在第一个代码示例中调用子字段,因此就像:

 [{
    "userInfo":{
        "first_name": "Shane",
        "last_name": "Renvoise",
        "username": "srenvoise0"
    },
    "currentOrder":{
        "address": "3698 Upham Terrace",
        "city": "Lincoln",
        "state": "Nebraska",
        "zip": "68524"
    },

0 个答案:

没有答案