...
/Enumerations and Model Classes in Model Code
Enumerations and Model Classes in Model Code
Let’s take a look at how the model class is coded.
We'll cover the following...
We'll cover the following...
Code the enumerations
Enumerations are coded in the following way with the help of the Enumeration meta-class:
var PublicationFormEL = new Enumeration(["hardcover", "paperback", "ePub", "PDF"]);var BookCategoryEL = new Enumeration(["novel", "biography", "textbook", "other"]);var LanguageEL = new Enumeration({ "en": "English", "de": "German", "fr": "French", "es": "Spanish" });
Notice that LanguageEL defines a code list enumeration, while PublicationFormEL defines a simple enumeration.
Code the model class as JS class
It’s a good idea to ...