-
Notifications
You must be signed in to change notification settings - Fork 27.4k
docs(ngNonBindable): Document effect on attributes #16338
Conversation
The phrase "contents of the current DOM element" may be interpreted either as inclusive of the DOM element's attributes or as exclusive of the attributes. This situation concerns markup such as: <div ng-non-bindable ng-controller="MyController"></div> In practice, AngularJS does not compile or bind attribute values for elements which specify the `ng-non-bindable` directive. Extend the documentation to definitely describe this behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly this is only the case if the attribute is not part of a directive that has a higher priority than the ng-non-bindable
attribute, which has a priority of 1000.
It sounds like this is more complicated than we can describe in a parenthetical. Actually, I had trouble explaining it in a single sentence. In some ways, this feels like too much information for such a small detail. But in other ways, the fact that it requires so much text makes me think that it's important to document it. I've pushed up a commit to this effect. What do you think? |
src/ng/directive/ngNonBindable.js
Outdated
* contains what appears to be AngularJS directives and bindings but which should be ignored by | ||
* AngularJS. This could be the case if you have a site that displays snippets of code, for | ||
* instance. | ||
* DOM element.AngularJS will generally ignore each attribute of the element itself. Attributes will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the most succinct and accurate way of saying this is:
... tells AngularJS not to compile or bind the contents of the
current DOM element, including attribute directives that have a
lower priority than `ngNonBindable`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe including attribute directives on the element (itself)
to make it clear that we are not referring to attribute directives on the children.
(Also, I don't think this is restricted to attribute directives 😁)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the final text would be:
The
ngNonBindable
directive tells AngularJS not to compile or bind the contents of the
current DOM element, including directives on the element itself that have a
lower priority thanngNonBindable
.
This is useful if the element contains what appears to be AngularJS directives and bindings but which should be ignored by AngularJS. This could be the case if you have a site that displays snippets of code, for instance.
@jugglinmike would you make this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing.
@petebacondarwin @gkalpak @Narretz Thanks for the review! I've incorporated your feedback. |
Merged, thanks @jugglinmike ! |
My pleasure! |
The phrase "contents of the current DOM element" may be interpreted either as inclusive of the DOM element's attributes or as exclusive of the attributes. This situation concerns markup such as: <div ng-non-bindable ng-controller="MyController"></div> In practice, AngularJS does not compile or bind attribute values for elements which specify the `ng-non-bindable` directive. Extend the documentation to definitely describe this behavior. Closes angular#16338
The phrase "contents of the current DOM element" may be interpreted either as
inclusive of the DOM element's attributes or as exclusive of the attributes.
This situation concerns markup such as:
In practice, AngularJS does not compile or bind attribute values for elements
which specify the
ng-non-bindable
directive. Extend the documentation todefinitely describe this behavior.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
What is the current behavior? (You can also link to an open issue here)
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change?
Please check if the PR fulfills these requirements
Other information: