These are chat archives for canjs/canjs

3rd
Aug 2015
espretto
@espretto
Aug 03 2015 08:29
hi,
is it at all intended for can.computes properties to live within a can.Map instance? and if yes, would i have to manually .off() them or perform any additional teardown logic?

also, how to get hold of the root of a can.Map instance from within can.compute's function? example:

var ViewModel = can.Map.extend({
  model: ['...'],
  state: {
    example: can.compute(function () {
      this.model; // > undefined
    })
  }
});

or would you go down the can.Map.define's road to achieve this? like how?

Guido Smeets
@gsmeets
Aug 03 2015 12:43
does anyone know if there's a way to dynamically create a can.Component on a dom node from code?
or should I just generate a template snippet and parse that?
Guido Smeets
@gsmeets
Aug 03 2015 12:48
@matthewp I put my amd stache loader on github (https://github.com/Empirion/can-stache-amd), still needs documentation though. If you want you can pull that into the canjs repo as a plugin. I'll add docs later this week
dylanrtt
@dylanrtt
Aug 03 2015 22:43

@gsmeets I don't think there's a way to get a handle to the Component. I always do something like

can.stache('<my-component options="{options}"></my-component')({options: options})

and append the frag