ng-admin

Concatenate two fields in a ListView ng-admin


I have a listview with a few fields, two of the fields are firstName, lastName. I would like to display Name as a header and concatenate firstName and lastName.

How can I go about doing this?


Solution

  • Here is the snippet to do so:

    var user = nga.entity('Users');
    user.listView()
          .fields([
              nga.field('id').label('Name').map(function (value, entry) {
                  return entry.firstName + ' ' + entry.lastName;
              })
          ]);