new module:ct-menu /model /Menu Factory()
This class allows the user to create a model from a configuration map.
Example:
{
alias:'caplin.anAlias',
options:
{
label: 'a Label',
otherOption: 'something'
},
items:
[
{
alias:'caplinx.myAlias',
},
{
options:
{
label: 'another label'
}
}
]
}
The table below explains each possible option to represent a Model
.
name | default | type | description |
---|---|---|---|
alias | String |
The alias for the model to create. This parameter is optional, either a Item or
a Menu will be created in case an alias is not provided.
|
|
options | Map | The options which will be passed to the model that is created. This parameter is optional. | |
items | array |
An array of Model configuration map representations. This parameter is optional.
|
Methods
(static) create(config) → {module:ct-menu /Model}
Returns an instance of a module:ct-menu/Model
represented configuration map passed as a parameter.
Parameters:
Name | Type | Description |
---|---|---|
config |
Map | Map to recreate the model from. |
Throws:
-
-
If config is not a valid object.
- Type
-
module:ct-core
/Error
-
-
-
If an instance of
module:ct-menu/model/Menu
gets generated but no items get provided or the 'items' section is not an array. - Type
-
module:ct-core
/Error
-
Returns:
- Type
-
module:ct-menu
/Model