ng-repeat: access key and value for each object in array of objects

前端 未结 6 797
清歌不尽
清歌不尽 2020-12-04 15:06

I have an array of objects and I am using an ng-repeat to iterate over them, which is easy. The array looks something like this:

$scope.steps =         


        
6条回答
  •  情歌与酒
    2020-12-04 16:04

    In fact, your data is not well design. You'd better use something like :

    $scope.steps = [
        {stepName: "companyName", isComplete: true},
        {stepName: "businessType", isComplete: true},
        {stepName: "physicalAddress", isComplete: true}
    ];
    

    Then it is easy to do what you want :

    Step {{step.stepName}} status : {{step.isComplet}}

    Example: http://jsfiddle.net/rX7ba/

提交回复
热议问题