These are chat archives for canjs/canjs

Aug 2018
Dovid Bleier
Aug 08 2018 10:50
aha!, "preventDataBindings") returned true - investigating why
Dovid Bleier
Aug 08 2018 11:08
I traced it back to this line, "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?
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!!

Aug 08 2018 15:54
  • inside the viewModel (typo error)
Viktor Busko
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.
Aug 08 2018 16:08
@Lighttree Thanks! I also was looking at this example:
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
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
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
Aug 08 2018 19:38
Kevin Phillips
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
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