ViewParameters
In Dirigible all Views, Subviews, Editors, Windows and Perspectives have parameters assigned to them using the data-parameter
attribute.
ViewParameters
is used to get and parse those parameters to a JavaScript object.
- Module:
platform-core
- Source 1: platform-core/ui/platform/view.js
- Source 2: platform-core/utilities/view-parameters.js
- Web Link:
/services/web/platform-core/ui/platform/view.js
- Status:
stable
- Group:
platform
Basic Usage
If you are using the standard Dirigible view configuration, ViewParameters support is enabled automatically.
To initialize it, place this in your code:
exampleView.controller('ExampleViewController', ($scope, ViewParameters) => {...});
If you are making a custom view, you can use the second source (Source 2):
<link type="text/css" rel="stylesheet" href="/services/js/platform-core/utilities/view-parameters.js" />
Functions
Function | Description | Returns |
---|---|---|
ViewParameters.get() | Returns all view parameters. | Object |
getViewParameters(Params) | Returns all view parameters. | Object |
Typedefs
- Params :
Object
Note
Params in square brackets are optional.
Params : Object
Properties
Param | Type | Description |
---|---|---|
[vframe] | window |
iframe window. |
[attribute] | string |
The attribute to get and parse. By default, it's data-parameters . |
Note
Params in square brackets are optional.
Example
let dataParameters = ViewParameters.get();
// or for custom views (Source 2)
let dataParameters = getViewParameters();