These are chat archives for canjs/canjs

22nd
Feb 2018
Andrei Balmus
@abalmush
Feb 22 2018 07:22
hi guys in canjs 2 I was able to trigger events using can.trigger in canjs 3 we dont have can.trigger
let ViewModel = new can.Map({
        getOrderDetails: function(code) {
            can.trigger(this, {
                type: 'activateOrderDetails',
                detail: {
                    code: code
                }
            });
        }
    });
oh found looks like it’s now dispatch not trigger
Dovid Bleier
@dbleier
Feb 22 2018 18:30
how can I grab the value of another field in an on:click call? for example
<div id="updateula" on:click="sendCommand('urllauncher', document.getElementById('urllauncher').value)" class="remoteButton blue span2">Update URL Launcher</div>
document.getElementById('urllauncher').value sends undefined into my viewModel method
Dovid Bleier
@dbleier
Feb 22 2018 18:43
I solved it by pushing the value of the desired component to a vm prop, and then pulled it into the on:click. Don't know if that is the best solution.
Kevin Phillips
@phillipskevin
Feb 22 2018 18:55
you can use a template variable also
value:to="scope.vars.urllaunchervalue"
Dovid Bleier
@dbleier
Feb 22 2018 19:27
ah, good idea