Does anyone know how to navigate to other dashboard states for asset instead of devices? As I would like to navigate to other dashboard states for the different levels. I hope someone is able to help me with this issue of mine that I have tried solving for quite some time. Below will be the screenshots of the different levels for my dashboard and also the code I have put in my custom action.
I have tried many various ways and one of them is the one below:
var $injector = widgetContext.$scope.$injector;
$injector.get('assetService').getAsset(entityId.id).then
(function(asset) {
if(asset.getName == 'LEVEL 5') {
openDashboardState('building_level_view');
} else if(asset.getName == 'LEVEL 6') {
openDashboardState('building_level_lab_view');
} else {
openDashboardState('building_view');
}
});
function openDashboardState(StateId) {
var params = {
entityId: entityId,
entityName: entityName
};
widgetContext.stateController.openState(StateId, params, false);
}