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

fix($compile): attribute bindings should not break due to terminal directives #4649

Closed
wants to merge 1 commit into from

Conversation

IgorMinar
Copy link
Contributor

Recently we changed the priority of attribute interpolation directive to -100
to ensure that it executes early in the post linking phase. This causes issues
with when terminal directives are placed on elements with attribute bindings
because the terminal directive will usually have 0 or higher priority which
results in attr interpolation directive not being applied to the element.

To fix this issue I'm switching the priority back to 100 and making moving the
binding setup into the pre-linking function.

This means that:

  • terminal directives with priority lower than 100 will not affect the attribute
    binding
  • if a directive wants to add or alter bindings it can do so in the pre-linking
    phase, as long as the priority of this directive is more than 100
  • all post-linking functions will execute after the attribute binding has been
    set up
  • all pre-linking functions with directive priority lower than 100 will execute
    after the attribute bindings have been setup

BREAKING CHANGE: the attribute interpolation (binding) executes as a directive
with priority 100 and the binding is set up in the pre-linking phase. It used
to be that the priority was -100 in rc.2 (100 before rc.2) and that the binding
was setup in the post-linking phase.

Closes #4525
Closes #4528

@mary-poppins
Copy link

Thanks for the PR!

  • Contributor signed CLA now or in the past
    • If you just signed, leave a comment here with your real name
  • PR's commit messages follow the commit message format

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@ghost ghost assigned mhevery Oct 25, 2013
@mhevery
Copy link
Contributor

mhevery commented Oct 25, 2013

LGTM

attr.$set(name, value);
});
})
// we need to interpolate again, in case the attribute value has been updated
Copy link
Member

Choose a reason for hiding this comment

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

This comment worries me. That we have to interpolate twice seems wrong - this seems to catch if another directive changes an attribute that previously had an interpolation but what happens if another directive adds an interpolation to an attribute that didn't have interpolation before? Won't it be missed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes it will be. I don't think that there is a way around it.

if an attribute doesn't have interpolation at compile time then we won't establish a databinding for that attribute.

…rectives

Recently we changed the priority of attribute interpolation directive to -100
to ensure that it executes early in the post linking phase. This causes issues
with when terminal directives are placed on elements with attribute bindings
because the terminal directive will usually have 0 or higher priority which
results in attr interpolation directive not being applied to the element.

To fix this issue I'm switching the priority back to 100 and making moving the
binding setup into the pre-linking function.

This means that:

- terminal directives with priority lower than 100 will not affect the attribute
  binding
- if a directive wants to add or alter bindings it can do so in the pre-linking
  phase, as long as the priority of this directive is more than 100
- all post-linking functions will execute after the attribute binding has been
  set up
- all pre-linking functions with directive priority lower than 100 will execute
  after the attribute bindings have been setup

BREAKING CHANGE: the attribute interpolation (binding) executes as a directive
with priority 100 and the binding is set up in the pre-linking phase. It used
to be that the priority was -100 in rc.2 (100 before rc.2) and that the binding
was setup in the post-linking phase.

Closes angular#4525
Closes angular#4528
Closes angular#4649
@IgorMinar IgorMinar closed this in 79223ea Oct 25, 2013
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
…rectives

Recently we changed the priority of attribute interpolation directive to -100
to ensure that it executes early in the post linking phase. This causes issues
with when terminal directives are placed on elements with attribute bindings
because the terminal directive will usually have 0 or higher priority which
results in attr interpolation directive not being applied to the element.

To fix this issue I'm switching the priority back to 100 and making moving the
binding setup into the pre-linking function.

This means that:

- terminal directives with priority lower than 100 will not affect the attribute
  binding
- if a directive wants to add or alter bindings it can do so in the pre-linking
  phase, as long as the priority of this directive is more than 100
- all post-linking functions will execute after the attribute binding has been
  set up
- all pre-linking functions with directive priority lower than 100 will execute
  after the attribute bindings have been setup

BREAKING CHANGE: the attribute interpolation (binding) executes as a directive
with priority 100 and the binding is set up in the pre-linking phase. It used
to be that the priority was -100 in rc.2 (100 before rc.2) and that the binding
was setup in the post-linking phase.

Closes angular#4525
Closes angular#4528
Closes angular#4649
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
…rectives

Recently we changed the priority of attribute interpolation directive to -100
to ensure that it executes early in the post linking phase. This causes issues
with when terminal directives are placed on elements with attribute bindings
because the terminal directive will usually have 0 or higher priority which
results in attr interpolation directive not being applied to the element.

To fix this issue I'm switching the priority back to 100 and making moving the
binding setup into the pre-linking function.

This means that:

- terminal directives with priority lower than 100 will not affect the attribute
  binding
- if a directive wants to add or alter bindings it can do so in the pre-linking
  phase, as long as the priority of this directive is more than 100
- all post-linking functions will execute after the attribute binding has been
  set up
- all pre-linking functions with directive priority lower than 100 will execute
  after the attribute bindings have been setup

BREAKING CHANGE: the attribute interpolation (binding) executes as a directive
with priority 100 and the binding is set up in the pre-linking phase. It used
to be that the priority was -100 in rc.2 (100 before rc.2) and that the binding
was setup in the post-linking phase.

Closes angular#4525
Closes angular#4528
Closes angular#4649
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants