joel kornbluh joel kornbluh - 1 year ago 30
AngularJS Question

Where can I find a list of all ng directives and their priorities

Every angularjs directive has a priority, which defines the order at which the directive is compiled when it co-exists with other directives on the same element. (See here for details)

However, I was searching for a list/reference of all ng directives (i.e. directives in the default ng module), sorted by their respective priorities. I found nothing in the angular docs. Can someone provide such a list, or a link to such a list?


A quick look on the latest code (1.3):

  • 1200: ngSwitch, ngSwitchWhen, ngSwitchDefault
  • 1000: ngNonBindable, ngRepeat
  • 600: ngIf
  • 500: ngController
  • 450: ngInit
  • 400: ngInclude
  • 100: ngList, ngValue, option, ngMinlength, ngMaxlength, ngMin, ngMax, ngPattern
  • 99: ngHref, ngSrc, ngSrcset
  • 1: ngModel, select
  • 0: Everything else

But, in most cases, you don't need to bother with these, as long as you remember that ngIf and ngRepeat are high up there.