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

JavaScript AngularJS Basics (1.x) Using Angular's Built In Directives Using ng-click To Change Application States

Where is the value `editing` coming from. Or previously the value `completed` came from?

I don't understand where we are getting these values from?

2 Answers

Joey Munroe
Joey Munroe
430 Points

In Angular you can define new variables in html without the variables having been defined in the controller. The editing variable was defined on the fly.

How does angular know the initial value for those variables defined on the fly? it seems the "todo.completed" is initialized as false since the page renders all the boxes unchecked.. is that correct?

Tony Brackins
Tony Brackins
28,766 Points

Faris Almomen Angular knows because it's a checkbox. If it's empty, it will be false. if it's checked it will be true.