Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

docs(ngNonBindable): Document effect on attributes #16338

Merged
merged 3 commits into from
Nov 27, 2017

Conversation

jugglinmike
Copy link
Contributor

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.

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

  • The commit message follows our guidelines
  • Fix/Feature: Docs have been added/updated
  • Fix/Feature: Tests have been added; existing tests pass

Other information:

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.
Copy link
Contributor

@petebacondarwin petebacondarwin left a 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.

@jugglinmike
Copy link
Contributor Author

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?

* 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
Copy link
Contributor

@petebacondarwin petebacondarwin Nov 22, 2017

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`. 

Copy link
Member

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 😁)

Copy link
Contributor

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 than ngNonBindable.
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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing.

@jugglinmike
Copy link
Contributor Author

@petebacondarwin @gkalpak @Narretz Thanks for the review! I've incorporated your feedback.

@Narretz Narretz merged commit 0fa5a37 into angular:master Nov 27, 2017
@Narretz
Copy link
Contributor

Narretz commented Nov 27, 2017

Merged, thanks @jugglinmike !

@jugglinmike
Copy link
Contributor Author

My pleasure!

Narretz pushed a commit to Narretz/angular.js that referenced this pull request Dec 7, 2017
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants