These are chat archives for canjs/canjs

Jan 2017
Pedro Mendes
Jan 21 2017 20:09

Hi. Is it possible to have one way binding a method of a property that's a can.Map? If so, what's the syntax? I've tried a few variations as shown in the bindings_test of v2.3.24.

<foo-bar {child-method}="@aNestedMap.method"></foo-bar>

Currently, I've workaround it adding another property to the parent scope

method: {
      type: "*",
      value: () => {},
      get(lastSetVal) {
        let nestedMap = this.attr("aNestedMap"),
          method = lastSetVal;
        if (aNestedMap && can.isFunction(aNestedMap.method)) {
          method = aNestedMap.method.bind(aNestedMap);
        return method;
<foo-bar {child-method}="@method"></foo-bar>
Frank Lemanschik
Jan 21 2017 21:18
as long as it works i woul
say keep it working :) there will come new syntax soon