Understanding Isolate Scope

John Lindquist
InstructorJohn Lindquist

Share this video with your friends

Send Tweet

By adding an isolated scope object to your AngularJS directive you can insure that each element using that directive has its own scope. This prevents it from affecting sibling directives and encapsulates the directive.

Ben Fischer
Ben Fischer
~ 7 years ago

The proliferation of the chore variable made this video a little bit confusing for me. The parameter name in the ChoreCtrl#logChore function, the name of the first parameter of the function in the done attribute, and the name of the model in the directive could all have been called something different.

I made a fiddle to play with the & binding. It might be helpful for anyone else that is still confused about why the directive template needed {chore: chore} http://jsfiddle.net/cL4guvxf/

Chris Gat
Chris Gat
~ 7 years ago

I was confused in exactly the same way Ben. Thanks for the fiddle. Cleared things up

Kostiantyn Hryshyn
Kostiantyn Hryshyn
~ 6 years ago

Example that lead you with no doubt, based on teachers video example - https://jsbin.com/digiru/7/edit?html,js,output

Jason
Jason
~ 5 years ago

"once we start having multiple kids you start running into a lot of issues" lol! #parentHumor

Paul
Paul
~ 5 years ago

NIce one Ben. This was a great help.