These are chat archives for canjs/canjs

13th
Sep 2017
Ranjan Subbiah
@ranjanbuilds
Sep 13 2017 14:28
hi all, I am creating a table that has a fair amount of stache logic. I can't create components to within the <thead>, <tbody>, etc because it doesn't like the custom elements in there. I was wondering if the best alternative would be to use {{<partialName}}.
to clarify, the logic is the same within each table element, and trying to figure out a way to get rid of the repetitiveness
Ilya Fadeev
@ilyavf
Sep 13 2017 15:55
Hi. Is there a way to check in can-component template whether <content> is provided? like {{#if content}} <content> {{else}} ... {{/if}}
Matthew Phillips
@matthewp
Sep 13 2017 16:06
@ranjanbuilds I would use an attr for that
in 3.0 you use can-view-callbacks
something like <tbody my-attr>
Or yeah, maybe an inline partial too, good idea
Chasen Le Hara
@chasenlehara
Sep 13 2017 16:11
Anyone looking for an answer to @ilyavf’s question: whatever is in <content> will be used if content isn’t passed to the component, so you generally don’t need to check if content was provided.
Ilya Fadeev
@ilyavf
Sep 13 2017 16:12
just got an answer from @BigAB and @matthewp
if content is provided the stuff inside of the <content>is not rendered
<content>I am rendered if content is <span class="emphasis show-default-content-can-be-html">NOT</span> provided</content>
thanks
Ranjan Subbiah
@ranjanbuilds
Sep 13 2017 16:38
@matthewp thanks
Michael Price
@web-mech
Sep 13 2017 21:31
is there a recommended way to do 2-way binding on selects with the new binding syntax?
Kevin Phillips
@phillipskevin
Sep 13 2017 21:33
value:bind
the docs are not updated... I'll open an issue for that
Michael Price
@web-mech
Sep 13 2017 21:34
thanks
Kevin Phillips
@phillipskevin
Sep 13 2017 21:34
the examples are using the new syntaxes though
Michael Price
@web-mech
Sep 13 2017 21:35
<select name="method" id="method" style="width:200px;" value:bind="selected">
        {{#each methods as method}}
            <option value="{{method.value}}">{{method.name}}</option>
        {{/each}}
    </select>
do you see anything wrong with this syntax?
works for a plain input, but not for this select
Kevin Phillips
@phillipskevin
Sep 13 2017 21:37
no, looks ok
Michael Price
@web-mech
Sep 13 2017 21:38
to be fair, the code behind this is horrid. i’ll investigate further
thanks
Kevin Phillips
@phillipskevin
Sep 13 2017 21:38
yeah, if you can reproduce in a jsbin I can take a look
Michael Price
@web-mech
Sep 13 2017 21:38
k cool