0 Replies Latest reply: Nov 25, 2016 3:30 PM by Alex Estrada RSS

    mashup manage objects

    Alex Estrada

      Hi folks,

       

      I need your help urgently with a qlik sense mashup. I'm new in both angularjs and qlik sense. The problem I have is that the performance of the application suffers as I navigate between different states to the point that objects take a long time to load and stop working correctly.

       

      Here is an excerpt from the code I use to load the application:

       

      var app;

       

      .................

       

      function getQlikApp(app1)

      {

          if (app1 == null) {

               appl =  qlik.openApp( "6bdf6084-6578-5f79-be7g-d8339089ae1s", config );

          }

          return appl;

      }

       

      myApp.config(function config($locationProvider, $routeProvider) {

          $routeProvider

         .when('/position', {

         controller: 'controller.position',

         templateUrl: 'position.html',

         resolve: {

         app: function () {

         app = getQlikApp(this.app);

        return app;

         }

         }

        })

       

        ......................

       

      As for the objects I have tried to load them by calling them directly:

       

      $route.current.locals.app.getObject(element, id);

       

      and through a service, passing the element and its id by parameters:

       

      myApp.service('getObjects', ['$route', '$q', function($route, $q) {

        var self = this;

        self.var = null;

        self.getObjects = function (objects) {

               var deferred = $q.defer(); 

               var promises = []; 

      angular.forEach(objects, function(key, value) { 

      $route.current.locals.app.getObject(value, key).then(function(){ 

      deferred.resolve(value); 

        }); 

        promises.push(deferred.promise); 

        });

        return $q.all(promises); 

        };

      }]);

       

       

      But the result is the same. After changing status, the console returns errors related to objects:

       

      Error from Engine: Object {jsonrpc: "2.0", id: 79, error: Object}

       

      Do you know where the problem is? Am I  handling the load of objects incorrectly? Should they be removed every time you change status? (In the API I have found method qlik.app.destroySessionObject (id)). If you need more code/details just tell and I will provide them.

       

      Thanks in advance for your help!