canjs / can-view-scope

Scope management for view engines
https://canjs.com/doc/can-view-scope.html
MIT License
4 stars 0 forks source link

Setter doesn't work. #193

Closed justinbmeyer closed 5 years ago

justinbmeyer commented 5 years ago

<button on:click='this.todo.disabled = false'>allow</button>

This seems to be trying to set this.disabled incorrectly.

Component.extend({
    tag: "todo-create",
    view: `

            <div class="form-group">
                <label>Name</label>
                <input class="form-control"
                    on:input:value:bind='this.todo.name'/>
            </div>
        <button on:click='this.todo.disabled = false'>allow</button>
            {{this.todo.disabled}}
            <button disabled:from="todo.disabled"
                class="btn btn-primary">
                {{# if(this.todo.isSaving()) }}
                    Creating .... 
                {{ else }}
                    Create Todo 
                {{/if}}
            </button> 

    `,
    ViewModel: {
        todo: {
            default(){
                return new DefineMap({disabled: true})
            }
        }
    }
});
cherifGsoul commented 5 years ago

I can not reproduce the issue in this codepen , could it be fixed?

chasenlehara commented 5 years ago

Thanks @cherifGsoul, this looks fixed as of can@5.21.5