Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
177 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 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...