Search code examples
javascriptangularjsangularjs-scope

How to check if scope is isolated?


Is somehow possible to check whether angular scope is isolated or not, having the scope only?

I know, that isolated and not isolated scopes have different prototypes. However these prototypes are private in angular and cannot be easily accessed. Checking the prototype name seems quite dirty approach.

Any better idea?


Solution

  • The first difference I know is, that Isolated scope has "$root" field, which is rootScope.

    The second difference is, that Isolated scope has "$$isolateBindings" field, but not isolated has not