Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 02 09:33
    xartd starred canjs/canjs
  • Mar 28 08:25
    vscuorzo starred canjs/canjs
  • Mar 24 13:17
  • Mar 16 13:19
    gdkttt starred canjs/canjs
  • Mar 08 16:50
    themyshkin removed as member
  • Mar 07 15:02
    baali-boudjemaa starred canjs/canjs
  • Feb 26 12:41
    horikeso starred canjs/canjs
  • Feb 22 17:42
    dnalbach starred canjs/canjs
  • Feb 17 13:45
    BirolAYDIN starred canjs/canjs
  • Feb 15 17:22
    prawee starred canjs/canjs
  • Feb 15 12:08
    philipstubbs13 starred canjs/canjs
  • Feb 13 20:42
    justinbmeyer commented #5456
  • Feb 13 06:49
    frank-dspeed commented #5456
  • Feb 12 21:42
    justinbmeyer closed #4872
  • Feb 12 21:42
    justinbmeyer closed #4870
  • Feb 12 21:42
    justinbmeyer closed #4868
  • Feb 12 21:42
    justinbmeyer closed #4867
  • Feb 12 21:42
    justinbmeyer closed #4853
  • Feb 12 21:42
    justinbmeyer closed #4852
  • Feb 12 21:42
    justinbmeyer commented #5456
dylanrtt
@dylanrtt
are you asking how to use it in a template?
Thomas Sieverding
@Bajix
yes
My impression was that I’d be able to do <foo *bar> … {{*bar.someProp}} ..</foo>
I’m a little confused though, as I had expected %root.bar to be set as the exported vm
dylanrtt
@dylanrtt
scope lookups to component viewmodels don't fall-through to %root if that's what you are thinking
whereas scope in the template does (not sure if I said that right)
Thomas Sieverding
@Bajix
I see - I had thought %root was the template scope
dylanrtt
@dylanrtt
This message was deleted
Thomas Sieverding
@Bajix
%root is the top most ref?
So if you’re doing leakScope: false, then child components would have %root === the vm of the parent
dylanrtt
@dylanrtt
yes, the top most ref
shouldn't matter with leakScope:whatever
Thomas Sieverding
@Bajix
That’s inconsistent w/ the docs. *bar should be the vm itself
dylanrtt
@dylanrtt
oh sorry my bad, I don't usually use that syntax
Thomas Sieverding
@Bajix
Well, leakScope would just mean that it’s now the top most ref
So if I had <my-app *app><my-service>{{>views/index}}</my-service></my-app>, shouldn’t I be able to do {{*app.foo}} within index?
dylanrtt
@dylanrtt
I don't think so. *app would only be available within the outer template. They are not passed down
Thomas Sieverding
@Bajix
Even if my-service uses leakScope: true?
dylanrtt
@dylanrtt
honestly, I'm not totally sure but I don't think reference scope is inherited in partials. not sure why the component's leakScope would matter
Thomas Sieverding
@Bajix
Hmm. I had been treating it like a shortcut to my root scope, but I guess that’s innaccurate
dylanrtt
@dylanrtt
what does %root have to do with your latest example?
Thomas Sieverding
@Bajix
leakScope affects %root, and I had though that * was intended to manipulate root
W/ what I’m working on, I have a top level container component, and I was trying to export it’s vm as *ui, then wrap a partial in a service component, and access *ui within that partial
dylanrtt
@dylanrtt
I believe %root was added initially for ssr. *ref bindings were added so you could easily share values between components without setting up an initial parent value to which those components would bind
Thomas Sieverding
@Bajix
Yea, so it’s really in there for sibling interactions
dylanrtt
@dylanrtt
exactly
Thomas Sieverding
@Bajix
My misconception was thinking that it was a shortcut to the parent most can.view.Scope
It’s not partial friendly for that reason
dylanrtt
@dylanrtt
sibling interactions where siblings is defined as anything in the template
if you replace the partial with a component, you could pass the *app into it
Thomas Sieverding
@Bajix
Well, not sure that would work in my case
<chat-service {_id}="{_id}" {^is-loading}="./isLoading" {^is-enabled}="./isEnabled" {(is-expanded)}="./isExpanded" {is-focused}="./isFocused" {(is-opened)}="./isOpened" {isMobile}="./isMobile">
  {{>chat/views/core}}
</chat-service>
There we go
That’s my container’s template, and I’d like the container’s vm to be accessible by my partial as ui
dylanrtt
@dylanrtt
Is there a reason you don't just make chat/views/core the template of <chat-service>? Is this a flexibility thing?
Thomas Sieverding
@Bajix
Yup. The service adds some things to the scope, and ties in web sockets
I have other areas in which I want to use the service to mediate my state
dylanrtt
@dylanrtt
yeah you may have to make a component for each partial then
if you want to use ref scope
Thomas Sieverding
@Bajix
How would a component fit into play here?
dylanrtt
@dylanrtt
I imagine the child-to-parent bindings would work in the partial
Thomas Sieverding
@Bajix
They do
I was having issues earlier with doing {ui}=“./"
dylanrtt
@dylanrtt
<chat-service {^is-loading}="*isLoading">
  <chat-view view="core" is-loading="*isLoading"></chat-view>
</chat-service>
Thomas Sieverding
@Bajix
I just want a reference key so that other partials can look up the scope tree w/out needing to know how far it’s nested
My use case is to do stuff like ($click)=“ui.attr(‘userMenu’, false)"
dylanrtt
@dylanrtt
with isLoading available in <chat-view>, it can load the partial and the partial will see it
Thomas Sieverding
@Bajix
It would be cool if you could set component’s templates
<chat-service template=“chat/views/core”></chat-service>
That’d be the dream