I've a list of users that contains object with spaces like this;
'User Name, First Name, Last Name, Phone #, User Image'
while binding this list to datatable, I'm doing this to achieve my data
<tr ng-repeat="user in lstUsers | orderBy : ['User Name']>
<td> <img ngf-thumbnail="user['User Image']" alt="" id="imgUserImage{{$index}}" /></td>
<td>{{ user['User Name'] }}</td>
<td>{{ user['First Name'] }}</td>
<td>{{ user['Last Name'] }}</td>
<td>{{ user['Phone #'] }}</td>
</tr>
it works perfectly fine except the order by, it gives error if I use it in this way orderBy : ['User Name']
Error: [$parse:syntax] Syntax Error: Token 'Name' is an unexpected token at column 6 of the expression [User Name] starting at [Name].
and if I use orderBy : '[User Name]' , it throws this error;
Error: [$parse:syntax] Syntax Error: Token 'Name' is unexpected, expecting []] at column 7 of the expression [[User Name]] starting at [Name]].
and if I use orderBy : 'User Name' , it throws this error;
Error: [$parse:syntax] Syntax Error: Token 'Name' is an unexpected token at column 6 of the expression [User Name] starting at [Name].
and if I use it without space like this orderBy : 'UserName' , it doesn't give any error but not apply any order to table.
What should I do to apply order on table? Any kind of help will be appreciated.