Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't set bound object null #248

Closed
davismj opened this issue Nov 30, 2015 · 1 comment
Closed

Can't set bound object null #248

davismj opened this issue Nov 30, 2015 · 1 comment

Comments

@davismj
Copy link
Member

davismj commented Nov 30, 2015

I have a basic master/detail view: A master list where you can select a user to open the user details, and a detail panel where you can edit the user details.

However, once bound, setting the user to null is immediately reverted by Aurelia. Here's the code:

export default class UserViewModel {
  users;
  user;

  constructor() {
    this.user = null;
    this.users = [{ name: 'user1' }];
  }

  select(user) {
    this.user = user;
  }

  deselect() {
    this.user = null;
  }
}
 <div>
    <table>
      <tr repeat.for="user of users" click.delegate="select(user)">
        <td>${user.name}</td>
      </tr>
    </table>
  </div>
  <div>
    <form reset.delegate="deselect()">
        <input type="text" value.bind="user.name" />
        <button type="reset">Cancel</button>
    </form>
  </div>

However, if I remove the line <input type="text" value.bind="user.name" /> user gets correctly set to and from null.

@jdanyow
Copy link
Contributor

jdanyow commented Nov 30, 2015

Keep an eye on this issue for updates.

@jdanyow jdanyow closed this as completed Nov 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants