Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 04 22:03
    chasenlehara opened #5440
  • Dec 04 22:03
    chasenlehara labeled #5440
  • Dec 04 19:18
    cherifGsoul review_requested #5432
  • Dec 04 14:09
    m-ahmadi starred canjs/canjs
  • Dec 04 10:52
    ansyeow starred canjs/canjs
  • Dec 03 14:53
    matthewp commented #5439
  • Dec 03 14:30
    frank-dspeed opened #5439
  • Dec 02 18:13
    greenkeeper[bot] commented #5392
  • Dec 02 18:13

    greenkeeper[bot] on core-js-3.4.7

    chore(package): update core-js … (compare)

  • Dec 02 17:48
    greenkeeper[bot] commented #5392
  • Dec 02 17:48

    greenkeeper[bot] on core-js-3.4.6

    chore(package): update core-js … (compare)

  • Dec 02 15:38
    phillipskevin commented #5438
  • Dec 02 15:38
    phillipskevin closed #5438
  • Dec 02 15:38
    phillipskevin commented #5438
  • Dec 01 23:28
    justinbmeyer commented #5438
  • Dec 01 23:06
    justinbmeyer commented #5438
  • Dec 01 23:06
    justinbmeyer commented #5438
  • Dec 01 23:04
    justinbmeyer edited #5438
  • Dec 01 23:03
    justinbmeyer opened #5438
  • Nov 29 15:01
    cherifGsoul synchronize #5432
Alexis Abril
@alexisabril
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

Ilya Fadeev
@ilyavf
Yeah, thanks @justinbmeyer . Click update to see it. If you remove the binding declaration from the template, the setter is called once.
Justin Meyer
@justinbmeyer
@ilyavf so is the button or anything related to this?
like, does there even have to be a component?
to see the problem
could you just pass a map with similar defined behavior?
Ilya Fadeev
@ilyavf
ok, will do
like, with a bind() ?
Justin Meyer
@justinbmeyer
oh, I have to click update to see the problem?
Ilya Fadeev
@ilyavf
yes, u have to click
Justin Meyer
@justinbmeyer
this is most likely b/c of the two-way binding
clicking update changes child's searchTerms, which changes parent's myval, which again tries to change child's searchTerms
oh, those only track one direction
we might need to add the other direction
viewModelPropertyUpdates[searchTerms] will be true only after parent's myval changes
we could have a similar protection coming back the other way
Justin Meyer
@justinbmeyer
basically when parent CHANGES child ... we protect against child then changing the parent
but when child CHANGES parent ... we don't currently protect the parent from trying to change the child as a result
Ilya Fadeev
@ilyavf
what line would this be ("when child changes parent")?