Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to unload and load different component #175

Closed
shan75 opened this issue Sep 28, 2018 · 7 comments · Fixed by #188
Closed

How to unload and load different component #175

shan75 opened this issue Sep 28, 2018 · 7 comments · Fixed by #188

Comments

@shan75
Copy link

shan75 commented Sep 28, 2018

Hi

Thanks for this library. This is a great piece of work which helps to load components dynamically. I am struggling to achieve one thing.

I need to build a four step wizard in my app. I need to load one component to next component for four steps and also navigate between back and forth. For example on page load I setup
Wizard1Component dynamically which works. On click of of next button, I need to load Wizard2Component and it works. But wizard two will have back and next buttons. I can't load wizard1Component again. It is not changing or not giving any errors.

Is there any issues to achieve this? Or how can I achieve this?

Please advice

Thanks
Shan

@gund
Copy link
Owner

gund commented Sep 28, 2018

Hi, to load/unload dynamic components you just have to change the @Input and that will be enough.
To unload - you can set it to null.

@semlibraries
Copy link

Hi Gund,
Can you explain more?

How do on a click, can swap the component?
I declare the component and than on click try to assign other component but it says instance of null.

Cannot read property 'instance' of null
at IoService.get [as _componentInst] (

@gund
Copy link
Owner

gund commented Oct 15, 2018

@semlibraries I think it will be easier if you can create example app on stackblitz.com so I can have a look

@semlibraries
Copy link

Hi @gund I done it here: https://angular-zupxfn.stackblitz.io
Hope this shows. You can see in the console log.

@gund
Copy link
Owner

gund commented Oct 16, 2018

🎉 This issue has been resolved in version 3.1.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@frontr-uk
Copy link

there is an issue trying to update the component on calling a method.

@CaptainMat
Copy link

Hello, is it possible to report this fix in V2.X ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants