1

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);
}
Rumit Patel
  • 8,830
  • 18
  • 51
  • 70
Nora J
  • 11
  • 1

1 Answers1

1

In case you still have the problem try asset.name instead of asset.getName.

It worked for me (on demo platform)

4b0
  • 21,981
  • 30
  • 95
  • 142