Unloading lazy loaded modules in Angular 5 - html

I want to unload all used modules when a user logs out of the webside to reset the application. When a new logs into the backendserver with the same running application all lazy loaded modules are still there.
I did some research and seems to me like it isn't possible by now.
Does somebody know a solution or a githublink to the ticket?

I guess unloading my modules was the wrong direction.
Once the chunks are loaded they shouldn't be constructed again.
I register the services in another service. Now when I Logout I call a function which iterates through all the services and calls a function for every service which empties all data by the previous User.
----------EDIT---------
Seeing that this question still get views here is a solution I used for some Apps:
Kudos to user benh80
Resetting the complete App and reloading it:
Resetting Angular 2 App

the whole point of using lazy loading is to load the relevant modules for a component. Once you log out the application it actually loads the modules which need for that component. Hence there is nothing to unload

Related

Flex Security Sandbox Violation just started happening

I have an http handler built and running on my website server. Code in flex generates a http request then navigates to the handler, which generates and streams back file information for the user to download.
Basically the request sends image data and the return result is a pptx stream with the image data in a powerpoint slide.
This worked fantastically this morning until about an hour ago. I have no idea what changed, but every swf I am building which attempts to access this handler is now giving me:
* Security Sandbox Violation *
Connection to https://g1.localhost/Turm/BounceBack.aspx halted - not permitted from https://g1.localhost/Turm/FlashApps/ImageAndExporting.swf?debug=true
I even fully qualified the BounceBack.aspx name (it was a relative url until just now) in case something was confusing the flash player, but as you can see, the url request and the swf are loaded from exactly the same domain (even the same virtual app in the web domain).
I have even added the physical filepath as a 'trusted folder' in my flash player security settings.
What gives? Anyone have any suggestions?
Using the Apache 4.9.1 SDK and latest version of flashplayer.
As mentioned, this worked all day yesterday and this morning. I cannot figure out what has changed, but am having no luck resolving the issue, source code has not changed.
Finally figured out what changed. I move the navigation to my ASPX handler into a seperate method that delays invoation till after a UI update. Becuase I use the same ui components for printing as well as exporting, I tested the updates with the print feature and that worked without error. About an our later, I noticed the handlers were failing. Since the url request is not handled inside a UI interaction event (Like MouseEvent.CLICK) the flash player was preventing the call. Once I moved the navigation back into the event handler, the sandbox violation went away.
If you ask me, not a very good error message due to the actual problem encountered, but ... you learn something every day.

How to delay MainPage, so it starts after data is loaded?

I have an application that stores data in isolated storage. I have a function to read the data (called in Apps.xaml.cs):
await ReadData();
However, before the data read, OnNavigatedTo is called in MainPage. At that point the buffer holding the data is still null.
How can I prevent MainPage.OnNavigateTo() from being as long as ReadData is not complete?
I tried syncing Apps & MainPage by setting a semaphore in Apps, and WaitOne() in the MainPage constructor. This hang the app on the WaitOne.
Any idea how this timing problem can be solved?
You can't delay the loading of the main page - as if the loading cycle is not executed within a timely fashion the app will be closed by the OS.
The best way around this is to create an interim splash page, which will handle the downloading of data whilst showing UI to the user. Once the data has downloaded you can then redirect to your main application page.

Why does my second loaded subapp stop after FlexEvent.INITIALIZE

I have a Flex 4 application that loads Flex 4 applications into it by using the mx.controls.SWFLoader component. I load the same swf-subapp several times as each subapp also runs standalone, and the content of the subapp is determined by a XML that I pass into it via the loader context.
This has worked until recently, but now, the second time I load the same swf (with a different xml) the loaded swf stops executing anything after the FlexEvent.INITIALIZE is triggered (I'm not doing anything in my initialized event handler). In other words, I don't get a CreationComplete event, which is where I start my code (and worse, no errors either).
As I've been working on a different part of my main application, I can't quite remember which change crashed my project, but what I do remember is that I updated my Flex SDK and I've hade similar silent errors in relation to a SDK upgrade earlier.
In my main application I do cleanup after myself before loading a new swf, so it shouldn't be garbage laying around.
Please help!
Solved it.
There was an enterframe handler that kept the first instance of the swf in memory, that in some way blocked the next one from loading (eventhough I used the removeAllElements on the parent container and hoped that would do the trick).
Now I use a NativeSignal and remove all listeners from that on onRemove handler (RobotLegs). Works like a charm.

Getting an error in FileReference.save method

I am currently working in Flex 3.0 I am getting an error(screen shot is given below). I am using Flash Player Version 10.0
Currently I am calling the HTTPService and in the resultHandler of that HTTPService i am getting an error in method filereference.save() . because this method is called only when the MouseEvent or Keyboard event is occured.
Is there any solution to overcome this situation or in other words calling the filereference.save method in ResultHandler.
The reason for this is that you are no longer allowed to automatically trigger the display of file saving popups, except in the event of the user actually requesting this, via an event generated by the user. Here is some more info on the subject: http://www.bogdanmanate.com/2010/05/12/flex-error-2176-when-using-filereference/
I got around this problem using the solution described in the post, namely by using a Yes/No alert, to indicate to the user that the file has finished loading and it is ready for download and finally by asking him to confirm that he wants to save it locally. You might consider thins user-unfriendly, but it's really about security. And once you know how to trigger the event, you can figure out ways of bypassing this UI issue.
Have a great day!
You cannot. You need a click button of the user to get it done. Dispatching a MouseEvent is useless. Romi approach coud help you. But you need for security reasons to made it for a button click.
What I did.. was in the result retrive the file location and open it like an html page. Then you can download it. I see no other solution than forcing the user to click a button like Romi said.
var u:URLRequest = new URLRequest(event.result);
navigateToURL(u, "_blank");
An alternative solution might be to send the file to the server, then have the server send it back to the client which should trigger the browser's save/open dialog box. But if the file is created by flex then this is not ideal bandwidth-wise.

Use airSWF.installApplication() after a URLLoader's callback

I'm trying to use a variation of the Flash Badge to install an AIR application. Here's what needs to happen:
User clicks "download"
Send a request using URLRequest/URLLoader to my web service to retrieve some information
Pass that information into the AIR app using the install/launch arguments
The problem I'm having is getting the airSWF to do anything after URLLoader is done. Since airSWF.installApplication() must be called within the handler of a user-generated event, it doesn't do anything when it's inside the URLLoader Complete event, and the fact that the original event was user generated doesn't seem to pass through the chain of events.
Is there anything I can do so that the above flow will work?
I've solved this by requesting the necessary data from the server (step 2) right away at the application start.
Not that elegant, since there is no guarantee that the user will click on the download button, and i store the just-in-case data anyway, but it works.
So when the user decides to click on the download button, I check air status, and if it's installed on the machine, i just use the already stored values, and download-->install or launch the application.