Lucia
Lucia

Reputation: 13577

What are all the directives that create child scope in AngularJS?

I didn't realise that ng-if creates a child scope, which caused quite a confusion. What're the reasons/benefits for ng-if's scope creating? What are other built-in directives that create child scopes?

The scope created within ngIf inherits from its parent scope using prototypal inheritance.

Upvotes: 2

Views: 333

Answers (1)

Lucia
Lucia

Reputation: 13577

So these are the keywords I used to find all the directives that create scope, thanks to @sp00m's prompt.

Providing that Angular's documentation is consistent in the way they describe directives, which it seems to be, below is the full list of results, in order of priority level of execution:

  1. 1200, ngSwitch
  2. 1000, ngRepeat
  3. 600, ngIf
  4. 500, ngController
  5. 400, ngInclude
  6. 400, ngView
  7. 0, ngMessage

Upvotes: 1

Related Questions