Pergunta

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.

Foi útil?

Solução

Try:

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

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top