Employee json schema
Copy & save employee.json in angular projects root folder. Modify it as per your requirement and generate CRUD working code for the 'Employee' entity.
Latest employee json schema will work with ngx-schema-to-code version 1.1.1 and above, if you have old one added, update it using folling command or use old one.
ng update ngx-schema-to-codeUse following command to generate CRUD code.
ng generate ngx-schema-to-code:curd employee.jsonemployee.json
employee.json (old)
{
"employee": {
"__requiredAllExcept": ["lastName","address.area"],
"firstName": {
"minLength": 2,
"maxLength": 30,
"hint": "First Name should be 2-30 characters long."
},
"lastName": {},
"emailAddress": {
"inputType": "email"
},
"photo": {
"dataType": "file",
"displayName": "Passport photo",
"inputType": "image"
},
"gender": {
"inputType": "radio",
"options": [
{ "description": "Male", "value": "m" },
{ "description": "Female", "value": "f" }
]
},
"dob": {
"dataType": "string",
"inputType": "date",
"displayName": "Date of Birth",
"format": "dd/mm/yyyy"
},
"married": {
"dataType": "boolean",
"label": "Are you married?"
},
"address": {
"dataType": "group",
"displayName": "Current Address",
"inputType": "group",
"properties": {
"area": {
"maxLength": 50
},
"city": {}
}
},
"education": {
"dataType": "array",
"inputType": "text"
},
"designation": {},
"salary": {
"dataType": "number",
"inputType": "number",
"min": 30000,
"max": 325000,
"step": 3000,
"hint": "Salary should be between 30000 and 325000."
},
"department": {
"inputType": "select",
"optionValues": [
"Account",
"Human Resource",
"Sales"
]
}
}
}