Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 10:20
    greenkeeper[bot] labeled #5426
  • 10:20
    greenkeeper[bot] opened #5426
  • 10:19

    greenkeeper[bot] on can-attribute-observable-2.0.2

    fix(package): update can-attrib… (compare)

  • Nov 18 21:05

    nlundquist on master

    Update dist for release (compare)

  • Nov 18 21:05

    nlundquist on v6.2.6

    Update dist for release 6.2.6 (compare)

  • Nov 18 20:22
    cherifGsoul review_requested #5425
  • Nov 18 20:22
    cherifGsoul commented #5425
  • Nov 18 20:19
    cherifGsoul synchronize #5425
  • Nov 18 20:19

    cherifGsoul on obserbale-properties-update-debugging-guid

    Fix observable properties wordi… (compare)

  • Nov 18 20:12

    nlundquist on master

    update can-stache-converters de… (compare)

  • Nov 18 20:12
    nlundquist closed #5424
  • Nov 18 19:24
    cherifGsoul review_requested #5425
  • Nov 18 19:24
    cherifGsoul opened #5425
  • Nov 18 19:21

    cherifGsoul on obserbale-properties-update-debugging-guid

    Remove ViewModel wording from d… (compare)

  • Nov 18 19:20

    phillipskevin on same-as-master

    (compare)

  • Nov 17 21:58
  • Nov 14 17:40
    nlundquist edited #5424
  • Nov 14 17:40
    nlundquist edited #5424
  • Nov 14 17:39
    nlundquist opened #5424
  • Nov 14 17:39
    nlundquist review_requested #5424
Kyle Gifford
@kylegifford

The code I'm working with uses

this.define = can.extend(parent.prototype.define, this.define);

in the child constructor, which I believe prevents extending objects on define

*on the child define
Kyle Gifford
@kylegifford
and if I do parent.prototype.define.foo.set.call(this, newVal);, I get in an infinite loop
Chris Gomez
@akagomez
@justinbmeyer @daffl Is there a recommended way to create dynamic components/dom nodes? A silly example would be: <{{span}}></{{span}}>
Alexis Abril
@alexisabril
@akagomez You could have a helper wrapped around document.createElement
{{#create ‘span’}}even have content, if you handle this in the helper{{/create}}
I guess it depends on what you’re trying to do
@kylegifford Yeah, that makes sense. I can’t remember if that line is exposed. If it is, you could have a local plugin that overwrites that line, then your code would work. You’d need to manually pull down those other methods you still want from the parent though(or re-create them on the child)
@akagomez I actually like what you had originally over the helper idea
I feel like we used to do this all the time with controls, but it was something similar
Chris Gomez
@akagomez
@alexisabril document.createElement(‘my-component') didn’t associate the node with my defined component.
Alexis Abril
@alexisabril
oh that won’t work, it would only work for dom nodes
dynamic components, I didn’t read that line in my head for some reason
I remember needing to do this once, but my solution wasn’t elegant either
sec, I think I can actually find the sample
David Luecke
@daffl

@akagomez

var component = 'my-component';
var tpl = '<' + component + '></' + component + '>';

var frag = can.stache(tpl)({});

?

Alexis Abril
@alexisabril
I used a single component to render subtemplates based on some input prior
for example, I had different inputs being rendered, but with similar properties being set(such as a label)
{{field whichField someProp otherData}}
in “field”, there was a switch that would render some template
Chris Gomez
@akagomez
@daffl It creates the DOM, but doesn’t initialize the component:
controller: function (options) {
      var frag = can.view.stache(
        '<can-import from="src/controller/landing/landing" />' +
        '<landing-controller></landing-controller>')();

      return frag;
    }
It even imports the script. But I get the error: WARN: can/view/scanner.js: No custom element found for landing-controller
Chris Gomez
@akagomez
I think the context of the <can-import> and the context of the rendered component are different.
@alexisabril @daffl This works though:
// controller.stache
<can-import from="src/controller/landing/landing" />
{{#controller}}{{/}}

// controller.js
controller: function (options) {
      var frag = can.view.stache(
        // '<can-import from="src/controller/landing/landing" />' +
        '<landing-controller></landing-controller>')();

      return frag;
    }
Chris Gomez
@akagomez
Is there a way to set the context of a rendered template?
Matthew Phillips
@matthewp
can-imports have to be loaded up front (like with the stache plugin)
but that to work
in 2.3.0-pre.x you can nest your component inside of the can-import
but you need to use {{#isResolved}}<landing-component/>{{/isResolved}}
because the can-import viewmodel is a promise
@akagomez the context of a renderered template is the first argument for a renderer
can.view.stache(txt) returns a renderer function
render(viewmodel)
Patrick Clancy
@patrickclancy
WebSocket connection to 'ws://localhost:8012/' failed
Opps… ignore
Matthew Phillips
@matthewp
heh
that's live-reload i bet
Patrick Clancy
@patrickclancy
yea… didn’t mean to paste my error here. But I am working through it
Justin Meyer
@justinbmeyer
@akagomez not with can.stache
can.stache needs to create elements in clone-able fragments
what you show is possible, but would be tricky
is possible to make stache do, but not easily
instead, I do what @alexisabril and have a helper
Andrei Balmus
@abalmush
Hello guys, quick question: Is it possible to attache can.Component to an existing custom tag without can.view ?
Chris Gomez
@akagomez
@abalmush As far as I know, no.
Andrei Balmus
@abalmush
@akagomez, thank you so much
Matthew Phillips
@matthewp
that's because you've overwritten parent.prototype.define
whoops, i just responded to a comment from a few days ago
carry on
Justin Meyer
@justinbmeyer

@ilyavf asked:

3:18 PM
Do you know why this setter is called twice after a template binding is added? http://jsbin.com/sinunew/edit?js,console,output