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: platform-core/ui/platform/view.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 manually get the parameters:
let dataParameters;
if (window.frameElement && window.frameElement.hasAttribute('data-parameters')) {
dataParameters = JSON.parse($window.frameElement.getAttribute('data-parameters'));
}
Functions
Function | Description | Returns |
---|---|---|
get() | Returns all view parameters. | Promise |
Example
let dataParameters = ViewParameters.get();