These are chat archives for canjs/canjs

27th
Dec 2018
Devendra Singh
@devs4522
Dec 27 2018 00:47
Hi There..
I am currently working on web application which is developed using canjs. Now i want to integrate an angular component (for example header component) in canjs application. Is it technically possible ? Any help is much appreciated.
Devendra Singh
@devs4522
Dec 27 2018 01:06
@marshallswain Can you please help me in this ?
Chasen Le Hara
@chasenlehara
Dec 27 2018 01:33
@devs4522 It should be doable. Have you run into any specific issues yet?
Devendra Singh
@devs4522
Dec 27 2018 02:40
I am in the initial phase of this task. Not sure where to start that's why looking for some one's advice how to go for this. Have you ever tried ?
@chasenlehara
Frank Lemanschik
@frank-dspeed
Dec 27 2018 09:26
@devs4522 ok i will help you
first you need to create something
for example a canjs app
then you put your angular <app-block>
inside or outside the canjs template stuff
then you import and init angular
if that errors you put that angular init into the connectedCallback of the related canjs component
or you do it via a setTimeout
it depends a lot on how much of the dom is controled by canjs
for example you could have some basic html with a little canjs widget and a total other part of html for angular
if the angular widget is inside the canjs widget you need connected callback or setTimeout
you can also use the on:inserted dom event
if you put the angular component dynamic into the dom
Frank Lemanschik
@frank-dspeed
Dec 27 2018 09:56
here i prepared a codepen mixup for you with a canjs and a angular app
Chasen Le Hara
@chasenlehara
Dec 27 2018 17:35
@devs4522 Which versions of Angular and CanJS?
Like Frank said, connectedCallback (in CanJS 4 & 5) or the inserted event (<= CanJS 3) will be your friend. You can probably have the Angular template in a stache file, then start Angular’s initialization process in either connectedCallback or the inserted event.
Devendra Singh
@devs4522
Dec 27 2018 18:44
@chasenlehara My canjs application is using <=3 canjs version and angular 4. Thanks for your help. These info are really helpful for me to kickstart my work.
@frank-dspeed Thanks a lot for your detailed info and codepen demo. i will start with this and will disturb you again in case of any issue :)