@justinbmeyer justinbmeyer released this Oct 3, 2018 · 39 commits to master since this release

Assets 2

Adds simple setters for on:event bindings like on:click="this.key = value"

Example:

      <p>Priority: {{this.priority}}</p>
      <button on:click="this.priority = 0">Urgent</button>
      <button on:click="this.priority = 1">Critical</button>
      <button on:click="this.priority = 10">Fahgettaboudit</button>

The key that is being set can be any key accessible by the scope. For example:

  • Set values on the viewModel - on:click="this.priority = 0".
  • Set values on a variable in the scope - on:click="todo.priority = 0".
  • Set values on a scope value - on:click="scope.element.value = 0"

The value that is being set must be represented by an expression that evaluates to a value. For example:

  • primitives - on:click="this.priority = 0"
  • variables - on:click="this.priority = todo.priority"
  • functions - on:click="this.priority = this.getPriority(todo)"

PR: #492