Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Francis N
Francis N
10,376 Points

Why does ng-blur has semi-colon and ng-change doesn't?

For "Using ng-change to set data state" video, I noticed that in the html template, ng-blur="editing = false;" has a semi-colon (;) while ng-change="todo.edited = true" doesn't. Why is that?

1 Answer

Ana Uribe
Ana Uribe
6,674 Points

The semi-colon is only to separate assignments, if you have only one statement the semicolon should not affect and you can choose to put it or not. Remember that you can add multiple assignments thanks to the use of semicolons to ng-blur and ng-change. eg.

<input ng-change="myVar=2;  mySecondVar=3"  ng-blur="myVar=23; mySecondVar=45" >

hope this helps =)