These are chat archives for canjs/canjs

8th
Aug 2018
Dovid Bleier
@dbleier
Aug 08 2018 10:50
aha! domData.get.call(el, "preventDataBindings") returned true - investigating why
Dovid Bleier
@dbleier
Aug 08 2018 11:08
I traced it back to this line domData.set.call(el, "preventDataBindings", true); in can-component.setup():292
but I don't understand why this should happen. Is there some setting I am missing in my component or parent component?
gregorgodoy
@gregorgodoy
Aug 08 2018 15:42

Hi! A have a question, how do I include an common js file like a jquery plugin? Specifically I want to use bootstraps modal and an carousel library called slick. Should I include them using can-import or just an <script src="path/assets/file.js" type="text/javascript"> inside the stache file? I also have to initialize the plugins, I suppose that should happend in

connectedCallback( element ) {
   //
}

inside te vieModel.

Any direction is really appreciated! Thanks!!

gregorgodoy
@gregorgodoy
Aug 08 2018 15:54
  • inside the viewModel (typo error)
Viktor Busko
@Lighttree
Aug 08 2018 16:01
I think it depends on what you are importing. If you have Module you can use <can-import> it has some nice things like dynamic / conditional loading.
connectedCallback looks logical place to make initialization since you have reference to element and you know that markup is ready at this moment.
gregorgodoy
@gregorgodoy
Aug 08 2018 16:08
@Lighttree Thanks! I also was looking at this example:
https://canjs.com/doc/guides/recipes/modals.html
I can see that doing an modal is relative simple, no necessary need bootstraps modal js script, but, what about transition animations or effects, actually done by the plugin? Or a carousel like behavior adds complexity (and time :) ) i want to avoid. Thanks again
Ivo Pinheiro
@ivospinheiro
Aug 08 2018 16:55
Hi guys!
Is it supposed that can-ajax always try to parse response as JSON in case of an error?
I have this example:
In my opinion this line should be inside a try catch
Am I right?
Dovid Bleier
@dbleier
Aug 08 2018 19:26
@phillipskevin sorry to be a pest, but any idea why preventDataBindings would be set to true? (see my comments above)
Justin Meyer
@justinbmeyer
Aug 08 2018 19:38
Kevin Phillips
@phillipskevin
Aug 08 2018 20:41
@dbleier so when the setup function in can-component runs, preventDataBindings is true already?
it should check preventDataBindings, then create the initial viewmodel, then set preventDataBindings to true
If you are available, we can set up some time tomorrow to pair on it.
Dovid Bleier
@dbleier
Aug 08 2018 21:05
  1. yes, seems like its setting preventDataBindings before creating the viewmodel
  1. I would love to set up a time to work on this tomorrow