Displaying foreign key entity in angularjs Datatable using rest API
Displaying foreign key entity in angularjs Datatable using rest API
I am using angularjs with datatable plugin with factory rest function to retrive data For Eg: Entry.
Using JSON such as api/user/:
{
"id": 61,
"user_name" "abc",
"city":
4
}
I want to display city name in the the user view.
{ "city": 4, "city_name": "Delhi" }
User View Controller code is something like this:
$scope.dtOptions = DTOptionsBuilder.fromFnPromise(Entry.query().$promise);
$scope.dtColumns = [
DTColumnBuilder.newColumn('id').withTitle('ID'),
DTColumnBuilder.newColumn('user_name').withTitle('User Name'),
DTColumnBuilder.newColumn('city_name').withTitle('City Name')
];
I just wan't to display city name through another factory rest method, please suggest something as soon as possible. Thank You in advance.