There are no UI for this service.
// sample enum
console.log(enumService.SampleEnum);
> { '1': 'تست یک', '2': 'تست دو' }
// get string value
var model = { test: 1 };
console.log(enumService.SampleEnum[model.test]);
> تست یک
// if you have some enumerated type number value in your model // you can get it's string value by this service model.gender; // 1 enumService.GenderType[model.Gender]; // male
Use this service to access enumerations string value.
| name | type | notes |
|---|---|---|
| could be anything | object | all object keys are numbers and all values are strings. |
Other kama angularjs modules use this module in various places. So although this service in empty by default, its existence is required.
You can expand enum service in your application by creating another service like this:
(function () {
angular
.module('yourModule')
.run(run)
.factory('customEnumService', customEnumService);
run.$inject = ['customEnumService'];
funcrion run(customEnumService) { }
customEnumService.$inject = ['enumService'];
function customEnumService(enumService) {
enumService.SampleEnum = { '1': 'تست 1', '2': 'تست 2' };
return enumService;
}
})();
After that you can access enums by both customEnumService and enumService, although we recommend that you only use enumService.