angular: Template local variables with dash (-) in them do not work

That is, this works:

<input #newtodo>
<button (click)="addTodo(newtodo.domElement.value)">Add Todo</button>

But this does not:

<input #new-todo>
<button (click)="addTodo(new-todo.domElement.value)">Add Todo</button>

Nor does this:

<input #newTodo>
<button (click)="addTodo(newTodo.domElement.value)">Add Todo</button>

If it’s not actually supposed to work, we should warn when users do this.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (12 by maintainers)

Most upvoted comments

@mhevery maybe just mention that in docs somewhere? I have created value newTodo and it cost me bit of time to spot that newtodo in browser