Formatting labels
Change-Id: I131f27f2f6fcd5cd76f4fbc13c632f7cd1aa17d0
diff --git a/src/app/views/crud/crud.ts b/src/app/views/crud/crud.ts
index 4663b59..d1e4d0e 100644
--- a/src/app/views/crud/crud.ts
+++ b/src/app/views/crud/crud.ts
@@ -1,12 +1,13 @@
import {IXosTableCfg} from '../../core/table/table';
import {IModelStoreService} from '../../datasources/stores/model.store';
+import {IXosConfigHelpersService} from '../../core/services/helpers/config.helpers';
export interface IXosCrudData {
model: string;
xosTableCfg: IXosTableCfg;
}
class CrudController {
- static $inject = ['$state', '$scope', 'ModelStore'];
+ static $inject = ['$state', '$scope', 'ModelStore', 'ConfigHelpers'];
public data: IXosCrudData;
public tableCfg: IXosTableCfg;
@@ -16,17 +17,19 @@
constructor(
private $state: angular.ui.IStateService,
private $scope: angular.IScope,
- private store: IModelStoreService
+ private store: IModelStoreService,
+ private ConfigHelpers: IXosConfigHelpersService
) {
this.data = this.$state.current.data;
this.tableCfg = this.data.xosTableCfg;
- this.title = this.data.model;
+ this.title = this.ConfigHelpers.pluralize(this.data.model);
this.store.query(this.data.model)
.subscribe(
(event) => {
// NOTE Observable mess with $digest cycles, we need to schedule the expression later
$scope.$evalAsync(() => {
+ this.title = this.ConfigHelpers.pluralize(this.data.model, event.length);
this.tableData = event;
});
}