These are chat archives for canjs/canjs

24th
Apr 2016
Julian
@pYr0x
Apr 24 2016 14:06
does someone know if i can export the resolved data from connect-tag
like <tt-model get-list="{tour=tourId}" {^value}="*lola">
but *lola is the promise
Julian
@pYr0x
Apr 24 2016 14:31
holy shit... the new binding syntax is incredible :D
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 24 2016 14:31
haha
Julian
@pYr0x
Apr 24 2016 14:31
we should add that behaivor to the connect docs
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 24 2016 14:32
which one?
Julian
@pYr0x
Apr 24 2016 14:32
<tt-model get-list="{tour=tourId}" {^@value}="lola">
you can export the resolved data to a viewModel property
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 24 2016 14:32
export to parent?
Julian
@pYr0x
Apr 24 2016 14:32
yep
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 24 2016 14:32
stache can handle promises now
Julian
@pYr0x
Apr 24 2016 14:33
and now you can have access to the reslved data outside the connect-tag
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 24 2016 14:33
yes
Julian
@pYr0x
Apr 24 2016 14:33
                <tt-model get-list="{tour=tourId}" {^@value}="lola">
                    {{#if isPending}}
                    Loading...
                    {{/if}}
                    {{#if isResolved}}
                    <select {($value)}="tourTagId" class="form-control" ($inserted)=".attr('tourTagId', value.0.tour_tag_id)">
                        <option value="">Bitte wählen...</option>
                        {{#each value}}
                        <option value="{{tour_tag_id}}">{{germanDate datum}}</option>
                        {{/each}}
                    </select>
                    {{/if}}
                </tt-model>
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 24 2016 14:33
did you check the article of 2.3 releaseN
Julian
@pYr0x
Apr 24 2016 14:33
which part?
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 24 2016 14:33
the new binding syntaxe
Julian
@pYr0x
Apr 24 2016 14:34
and my viewModel
var ViewModel = can.Map.extend({
        define: {
            tourTagId: {
                value: ""
            },
            lola: {
                get: function (lastSetValue, setAttrValue) {
                    var self = this;
                    //console.log(lastSetValue);
                    if(lastSetValue && lastSetValue.length) {
                        var filtered = lastSetValue.filter(function (item, index, list) {
                            return (self.attr('tourTagId') === item.attr("tour_tag_id"));
                        });
                        setAttrValue(filtered.attr('0.datum'));
                    }
                    //console.log(lastSetValue);
                }
            }
        }
}
and now you can have {{lola}} outside of <tt-model>
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 24 2016 14:35
oh lola drives you crazy :D
Julian
@pYr0x
Apr 24 2016 14:35
:D
foo and foobar sound not so hot ;D
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 24 2016 14:36
haha