Angular zen: directives and scope
¶ by Rob FrieselToday’s moment of Angular zen:
Try to think of it this way:
Anything that you set on the scope
object in the directive’s return object, those will be the properties pre-populated on the scope
argument passed to the scope
parameter in the function assigned to link
. And those can be inferred from the attributes passed on to the directive’s instance element.
There’s some magic going on there, and it isn’t totally clear from the docs how these things line up. But there’s a science to it.
Leave a Reply