Qlik Sense is getting better and better on every release!
I was working on a large website using Qlik Sense 2.1 and the Capability APIs where I used the template that I had created and blogged about Creating a website with Angular and the Capabilities API. I had almost finished the project, when we decided to upgrade to 2.2. Everything was fine, I was cleaning up my code and I was ready to deliver the project when we realized that most of the charts, had no interactivity!
So, lets fix our template to work properly in 2.2.
One of the two issues was the css. In 2.1 we had to use qlikui.css and client.css. In 2.2 these were replaced by qlik-styles.css. So in index.html replace L17-L18
Also, remove the icon fix we had in index.less and remove L134-L136. This has been fixed in the new stylesheet.
.sel-toolbar-span-icon {
top: -10px;
}
Another issue we found is that, we have to make sure that overflow-y: auto; is in both the html and body. We had that from beginning in this template but it seems to break things in 2.2 if it is only on body and not the html.
In the js/lib/main.js I used in the grid-service in order to make angular work. This has also been fixed and you can remove L30
define( "client.services/grid-service", {} );
Now, going to my last and more important issue, on why the interactivity was broken in 2.2. I started the blog by stating that "Qlik Sense is getting better and better on every release!" and this is so true. I spend several days trying to figure out why the interactivity was broken when I was moving from pages to pages and on random times. The issue was that simply the engine got so much faster on delivering the objects, that Angular could not keep up with it! Really, when the Capability App API app.getObject() is looking for the id to replace the html with, is looking for the parent element width and height. In my case, all of the objects, most of the time, had the canvas drawn with 0 height and width due to that! So, in order to fix this, unfortunately, I had to add a 1/2 second delay on getting my objects. So in the js/services/api.js, wrap L18-L24 in a timeout function
I would add this only if you have the interactivity issues like I have described above. In cases that you have small projects like this one and you do not have a lot of dependencies, this may not be needed at all!
I'm trying to setup your template locally with QS2.2, however I can't seem to get it to display the data from the Helpdesk Management app. All I see on http://localhost:4848/extensions/angularTemplate/index.html are the tabs Dashboard and Performance, and the link to Qlik in the footer. I downloaded the latest code from github and followed the steps in the original blog post and also this one.
The template works really well, and the directives are really useful
I'm still quite new to using Angular, so I have another question - how do I add another dependency for one of the views? I've added to the path to require.config and I then tried to add it to "angular.module('myApp', [ 'ngAnimate', 'ui.router', 'ui.bootstrap', 'three']" but I'm getting an error saying that the module is not available:
require.js:43 Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:modulerr] Failed to instantiate module three due to:
Error: [$injector:nomod] Module 'three' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
I'm trying to add the threejs library to render a globe in one of my views. I have the minified JS file in js/vendors/globe/three.min.js and in my view controller I have lines like:
var loader = new THREE.TextureLoader();
What do I need to do to be able to use the THREE in: