user804401
user804401

Reputation: 1994

Angularjs appended properties in drop down with spaces

I want to show spaces in the div options which I am appending multiple properties. The spaces are not shown. Below is my code

<select id="sel" class="input-block-level" ng-model="list_category" ng-options="obj.id as (obj.name + '    ' + obj.id) for obj in list_categories.data">    
        <option value="">Other</option>
    </select>
var app = angular.module('app', []);
function Ctrl($scope) {  
    $scope.list_categories = {
        data: [{
            id: 'id1',
            name: 'name1'
        }, {
            id: 'id2',
            name: 'name2'
        }]
    };       
    $scope.list_category = 'id2';
}

The spaces are not showing up if i append + ' ' + Should i add any CSS for this ??

Upvotes: 1

Views: 76

Answers (1)

Martin
Martin

Reputation: 1822

use &nbsp; instead of '' or set css white-space:pre

Upvotes: 1

Related Questions