문제

I have my controller set up like this:

function MyCtrl($scope) {
    $scope.obj = ["MobilePhone",null,"HomePhone"];
}

and im using an ng-repeat:

<div ng-controller="MyCtrl">
     <p ng-repeat="yeah in obj"> {{yeah}}</p>
</div>

and I need to show the empty space from the null value like this:

MobilePhone

HomePhone

but instead im getting this:

MobilePhone
HomePhone

Any help would be nice.

도움이 되었습니까?

해결책

Try:

<p ng-repeat="yeah in obj"> {{yeah || '&nbsp;' }}</p>

Working example: http://jsfiddle.net/63wWe/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top