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) Controllers and Scope Understanding Scope In Angular

Jason S
Jason S
16,247 Points

MainCtrl not have access to ImaSibling, but what about coolCtrl?

hi in the video he said mainCtrl does not have access to the imasibing one, but does coolCtrl have access to it? if so, why? are all three of them not on the same scope level?

1 Answer

Derrick Jann
Derrick Jann
2,910 Points

The scope level is

Top: rootScope

Next Level Down: mainCtrl

Next Level Down: coolCtrl siblingCtrl

-In order to have access/inherit methods, it must be a parent controller.

-coolCtrl's parent is mainCtrl, and mainCtrl's parent is rootScope. That means coolCtrl will have access to it's ancestor's methods i.e. mainCtrl and rootScope

-imasibling is not the parent of mainCtrl , so mainCtrl will not have access to the imasibling's methods