We have an angular 2 application (generated with angular-cli) with an iframe integration. I have generated an child component (so next to the standard "app" component, I have "child" component. Via the Qlik Explorer for Developers we can have some simple generated code to get some server connection boiler plate code (see below). I want to know what the user selected in the iframe, that's why I would like to have the qlik config with require components. I know it works when I just load the qlik app directly and put the js code from the qlik.js file in a script tag in the index.html. But when I want to load it dynamically (e.g. import it in a component), I get an error. Is this even possible?
I think the actual problem here is authentication. You're requesting the require.js resource from the default virtual proxy (prefix: '/') which doesn't allow anonymous access. That means your request for the require.js file is silently redirecting to a login screen and subsequently failing which is why you're getting that error. You should be able to validate this by inspecting the network tab in the browser developer tools.
Depending on what app you're trying to use you may be able to use the /showcase virtual proxy which allows anonymous access but only exposes apps that are part of the showcase solutions. Otherwise you can authenticate by using the same authentication flow provided in the "Basic Capability API Template" and use the /playground virtual proxy. Another example can be found in the "Untappd Capability API Dashboard".
That's not to say that your solution will work immediately once you're authenticated but it's a start. By loading the Capability APIs into your page you're also loading AngularJS 1.5 which means you'll be running 2 versions of angular in the same page. Not sure if you'll have issues there or not, it's not something I've done before.
Thanks for the answer, but it works fine when I just load everything via script tags in the index.html (head section) and I load my component with an Qlik app. If I load the script in the head section, I need to load at least my component or it will not find the css class it's looking for. In my case "qlik-embed".
But I want it to load dynamically (not in the head section) because I need to do some calculations on beforehand.