简体   繁体   中英

How to display text from object array in angular

Seems like it'd be pretty straight forward but I am not able to get my text to display

In my HTML I have <td>{{cabinetDetails.cabinetType}}</td> and my data source is $scope.cabinetDetails = [{cabinetType: 'panel'}];

Nothing is displaying in my HTML. I've also tried: $scope.cabinetDetails = [{'cabinetType': 'panel'}];

Any ideas?

It would appear you have made an array of objects, so I think the code that would currently work is either:

<td>{{cabinetDetails[0].cabinetType}}</td>

Or replace

$scope.cabinetDetails = [{cabinetType: 'panel'}];

with

$scope.cabinetDetails = {cabinetType: 'panel'};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM