Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
179 views
in Technique[技术] by (71.8m points)

angular - Get and display objectKeys values

Actually a have a array with this data

  "Stage" : {
    "ID01" : {
      "abeb5220-2003-4b8b-a6d5-853a40ca7d60" : "Full name"
    }
  }

And use this code to display the value of objects

<ng-container *ngIf="hasProperty(vaga.stage, stage.code)">
                  <div
                    ngxDraggable
                    (drag)="dragCandidate($event)"
                    class="candidate ngx-dnd-item"
                    [model]="{
                      codCandidate: candidate,
                      nameCandidate: vaga.stage[stage.code][candidate],
                      codeLastStage: stage.code,
                      codeLastVAga: vaga.id
                    }"
                    *ngFor="let candidate of objectKeys(vaga.stage[stage.code]); let i = index"
                  >
                    {{ vaga.stage[stage.code][candidate] }}
                  </div>

hasProperty Method

      hasProperty(obj, property) {
    // debugger;
    return typeof obj == "object" && obj.hasOwnProperty(property);
  }

I'm adding more data and the new array structure would be like this

      "Stage" : {
    "ID01" : {
      "abeb5220-2003-4b8b-a6d5-853a40ca7d60" : {
        "email" : "[email protected]",
        "name" : "Full name"
      }
    }
  } 

The question is: How display "name" value with changes above?

question from:https://stackoverflow.com/questions/65885855/get-and-display-objectkeys-values

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...