Angular2 with Dojo

299 views
Skip to first unread message

Arvind Nama

unread,
Feb 7, 2017, 12:20:39 AM2/7/17
to Angular and AngularJS discussion
Hi, 
  My application is primarily build using DOJO , we are planning to face off Dojo and move to Angular 2. 
We are planning to take few components at a time . 
Currently I have dojo Widget with would internally host Angular Module .

Everything works fine .
But i realized that with dojoWidget is destroyed  Angular Module ( and its components) are not destroyed.

Is there a way to force Destroy and angular module ?

Sander Elias

unread,
Feb 7, 2017, 4:19:17 AM2/7/17
to Angular and AngularJS discussion
Hi Arvind,

Good question. I'm looking into this!

Regards
Sander

Arvind Nama

unread,
Feb 10, 2017, 1:36:15 PM2/10/17
to Angular and AngularJS discussion
@Elias: Any success ?

Sander Elias

unread,
Feb 10, 2017, 9:20:10 PM2/10/17
to Angular and AngularJS discussion
Hi Arvind,

Oh, there is the question! (found muself the answer, but then forgot were the question was :) )
Yes, I have figured this one out. Currently, there is no way unloading a (lazy-loaded) module, aside from forcing a page-refresh.
I did put it on the radar of the team, but do not expect a change anytime soon.

Regards
Sander

Arvind Nama

unread,
Feb 11, 2017, 12:06:47 AM2/11/17
to ang...@googlegroups.com
Oh oh .. 

I found this piece of code .. 
If i destroy the main component using the below code , will it clean up all it child component s?

i.e. calling destroyChildCmp 

export class MainCmp implements OnDestroy {

   @ViewChild(ChildCmp) childCmpRef: ComponentRef<ChildCmp>;

   ngOnDestroy() {
      this.destroyChildCmp();
   }

   destroyChildCmp(){
      if (this.childCmpRef) {
         this.childCmpRef.destroy();
      }
   }
}

Sander Elias

unread,
Feb 11, 2017, 1:21:38 AM2/11/17
to Angular and AngularJS discussion
Arvind,

Ah, but that's something else as unloading a module! 
If an angular component gets destroyed, it does take down everything it has provided by itself. That is including the children of the component.
You should not have to destroy it by yourself unless you have some other (outside angular) code that's holding a reference.

However, currently, it is impossible to unload the code itself you loaded in with lazy loading. (This was your question after all?)

Regards
Sander

Arvind Nama

unread,
Feb 11, 2017, 2:46:33 AM2/11/17
to ang...@googlegroups.com
Actually 
Let me explain the scenario..

Dojo offers something called dijits ( which is equivalent to angular components)

I ve a wrapper dijit which bootstraps a ngModule( which would create angular  components)

Now when i destroy this dijit wrapper i dont think ngcomponents are getting destroyed ( i dont expect it either as some other external object hold its reference)

So this being the case i want to some how destroy these angular components?


Also i would like to know one more thing :
Is it possible to directly create angular components ( without wrapping them around an ngModule)
I remember see some samples but they were all on . beta releases of angular? 

If this is possible my dijit wrappers can create angular components and it will destroy Then when dijit wrapper gets destroyed.

--
Arvind Nama U

jamesmat...@yahoo.com

unread,
Feb 11, 2017, 9:25:47 AM2/11/17
to ang...@googlegroups.com

--------------------------------------------
On Sat, 2/11/17, Arvind Nama <arvi...@gmail.com> wrote:

Subject: Re: [AngularJS] Re: Angular2 with Dojo
To: ang...@googlegroups.com
Date: Saturday, February 11, 2017, 9:45 AM

Actually Let me
explain the scenario..
Dojo offers something called dijits
( which is equivalent to angular components)
I ve a wrapper dijit which
bootstraps a ngModule( which would create angular
 components)
Now when
i destroy this dijit wrapper i dont think ngcomponents are
getting destroyed ( i dont expect it either as some other
external object hold its reference)
So this being the case i want to
some how destroy these angular components?

Also i
would like to know one more thing :Is it possible
to directly create angular components ( without wrapping
them around an ngModule)I remember see some
samples but they were all on . beta releases of
angular? 
If this is
possible my dijit wrappers can create angular components and
it will destroy Then when dijit wrapper gets
destroyed.
--
Arvind Nama U



--

You received this message because you are subscribed to the
Google Groups "Angular and AngularJS discussion"
group.

To unsubscribe from this group and stop receiving emails
from it, send an email to angular+u...@googlegroups.com.

To post to this group, send email to ang...@googlegroups.com.

Visit this group at https://groups.google.com/group/angular.

For more options, visit https://groups.google.com/d/optout.
us juramantul prin care isi exprimau adeziunea la programul revolutiei.

Sander Elias

unread,
Feb 11, 2017, 9:36:24 AM2/11/17
to Angular and AngularJS discussion
Hi Arvind,


If an angular component is taken out of the dom, it gets destroyed, and it should clean up after itself. The code that is loaded for that module stay's in memory, and (if done correctly) gets reused on iterated use.
You can check the destroy being called by logging out some text in the ngOnDestroy life-cycle hook.

As far as I know, it is not possible anymore to create components that are not part of a ngModule. 
However, the router is not the only way to lazy-load code, you can use your code to do that, and you can incorporate that into your dijit's. Probably all this wrapping is a bad idea. Perhaps you can consider writing a Component that mimics an dijit, so you can just use angular alongside dojo, instead of wrapped into each other?

Regards
Sander


steffan...@yahoo.com

unread,
Feb 11, 2017, 4:01:22 PM2/11/17
to ang...@googlegroups.com
ntrarea Romaniei in razboiul mondial. Participarea la razboiul pentru eliberarea Basarabiei si a nordului Bucovinei. Raporturile cu Germania nazista. intre septembrie 1940 si august 1944 pot fi deosebite doua etape in implicarea Romaniei in conflictul mondial si anume: 1 septembrie 1940-iunie 1941 nonbeligeranta cu aderarea la Axa 2 iunie 1941 -august 1944 beligeranta alaturi de Axa.

steffan...@yahoo.com

unread,
Feb 11, 2017, 4:31:10 PM2/11/17
to ang...@googlegroups.com

--------------------------------------------
On Sat, 2/11/17, steffanieroney via Angular and AngularJS discussion <ang...@googlegroups.com> wrote:

Subject: Re: [AngularJS] Re: Angular2 with Dojo
To: ang...@googlegroups.com
Date: Saturday, February 11, 2017, 11:07 AM
https://groups.google.com/d/optout.olitic care prezidase pacea mondiala dupa razboiul incheiat in 1918 dar ele au

Arvind Nama

unread,
Feb 11, 2017, 5:08:06 PM2/11/17
to Angular and AngularJS discussion
Thanks Sander Elias  , 

If removing dom elements auto destroy Components , This is what i want ..I thought this was not happening ( will check by overriding onDestroy) .. Reason i asked was i have overriden onViewChanged method and i had a console log(..)
I was able to still see those logs when Dom Elements were removed . [ Let me check on the onDestroy] 

Also i dont want the ngModule part not getting unloaded Is fine with me [ may be i placed the question wrongly , i was more looking for component destroy]

floydj...@yahoo.com

unread,
Feb 12, 2017, 7:50:34 AM2/12/17
to ang...@googlegroups.com

--------------------------------------------
On Sun, 2/12/17, Arvind Nama <arvi...@gmail.com> wrote:

Subject: Re: [AngularJS] Re: Angular2 with Dojo
To: "Angular and AngularJS discussion" <ang...@googlegroups.com>
Date: Sunday, February 12, 2017, 12:08 AM
--

You received this message because you are subscribed to the
Google Groups "Angular and AngularJS discussion"
group.

To unsubscribe from this group and stop receiving emails
from it, send an email to angular+u...@googlegroups.com.

To post to this group, send email to ang...@googlegroups.com.

Visit this group at https://groups.google.com/group/angular.

For more options, visit https://groups.google.com/d/optout.
[ mai putin spectaculoasa. ii lipseau initiativa capitalul materia prima cresede munca libera garantiile sprijinul economic si stabilitatea politica. a natia otomana in Principate si stapanirea habsburgica in Transilvania creau OrT1 erioase obstacole. De aceea cel putin pana la 1829 in Principate mai ales

jamesmat...@yahoo.com

unread,
Feb 12, 2017, 8:12:25 AM2/12/17
to ang...@googlegroups.com

--------------------------------------------
On Sun, 2/12/17, floydjack428 via Angular and AngularJS discussion <ang...@googlegroups.com> wrote:

Subject: Re: [AngularJS] Re: Angular2 with Dojo
To: ang...@googlegroups.com
Date: Sunday, February 12, 2017, 2:50 PM
https://groups.google.com/d/optout.reti sa mergeti astfel inainte mergeti singuri dar nu cu generalul Antonescu...

floydj...@yahoo.com

unread,
Feb 13, 2017, 12:25:45 AM2/13/17
to ang...@googlegroups.com

--------------------------------------------
On Sun, 2/12/17, jamesmatthews431 via Angular and AngularJS discussion <ang...@googlegroups.com> wrote:

Subject: Re: [AngularJS] Re: Angular2 with Dojo
To: ang...@googlegroups.com
Date: Sunday, February 12, 2017, 3:11 PM
https://groups.google.com/d/optout.ale a marii proprietati. Totusi in 1889 guvernul conservator aflat la

rodman....@yahoo.com

unread,
Feb 13, 2017, 7:18:59 AM2/13/17
to ang...@googlegroups.com

--------------------------------------------
On Mon, 2/13/17, floydjack428 via Angular and AngularJS discussion <ang...@googlegroups.com> wrote:

Subject: Re: [AngularJS] Re: Angular2 with Dojo
To: ang...@googlegroups.com
Date: Monday, February 13, 2017, 7:24 AM
https://groups.google.com/d/optout.entre ale revolutiei din 1821 tinerarii ale pandurilor si arnautilor

Marco Ortelee

unread,
Nov 4, 2017, 12:45:52 AM11/4/17
to Angular and AngularJS discussion
Hi Arvind,

Currently we are also trying to host an angular modle inside a dojo widget. We can't get it to work.
Inside the template of the widget we added <my-app></my-app>.
We can not find a way to populate that <my-app> with our module.

Do you have an example for us that we can try-out.

Regards Marco

Op dinsdag 7 februari 2017 06:20:39 UTC+1 schreef Arvind Nama:
Reply all
Reply to author
Forward
0 new messages