Todd Palmer
Todd Palmer

Reputation: 1102

AngularJS < binding for components and directives

It seems AngularJS has a new binding symbol: <. The documentation mentions < for Components but isn't really clear about Directives.

So two questions:

  1. Is < binding applicable for Directives as well as Components?
  2. When should I use the < binding?

Upvotes: 1

Views: 46

Answers (1)

Todd Palmer
Todd Palmer

Reputation: 1102

Is < binding applicable for Directives as well as Components?

Short answer: Yes

Even though < isn't specifically mentioned on the Directives page in the Developer's Guide. It is documented in the Comprehensive Directive API page which is here:

https://docs.angularjs.org/api/ng/service/$compile#-scope-

When should I use the < binding?

You should use the < binding when you want to specify that the Component or Directive doesn't update the parameter object. Basically, you are saying that this parameter is for input to the directive.

Hence, going forward you should probably only use = binding when your Component or Directive intends to update the parameter.

Upvotes: 1

Related Questions