ng-src inside <script> not working in 1.2.0-rc.3 #4528

Closed
sarath2 opened this Issue Oct 19, 2013 · 4 comments
@sarath2

<script type="text/javascript" ng-src="{{test}}"></script>

Not working on rc3.
But working well in rc1.

Also
<link ng-href="{{test}}" rel="stylesheet"> work perfectly.

@caitp

http://plnkr.co/edit/27omboaE6Iry2YYS2JYk?p=preview with the <img> tag it seems to be working correctly, but with the <script> tag, the $observe fn gets an uninterpolated value. I don't totally understand why that's happening. It's like the <script> tag isn't aware of its scope or something.

@petebacondarwin
Angular member

I think this is related to #4524

@petebacondarwin
Angular member

This is actually due to the script element directive: https://github.com/angular/angular.js/blob/master/src/ng/directive/script.js.
This sets terminal to true and has a higher priority (0) than the "attribute interpolation" directive (-100): https://github.com/angular/angular.js/blob/master/src/ng/compile.js#L1384

@petebacondarwin
Angular member

Introduced by @IgorMinar's commit 31f190d

@IgorMinar IgorMinar added a commit that closed this issue Oct 25, 2013
@IgorMinar IgorMinar fix($compile): attribute bindings should not break due to terminal di…
…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 #4525
Closes #4528
Closes #4649
79223ea
@IgorMinar IgorMinar closed this in 79223ea Oct 25, 2013
@jamesdaily jamesdaily added a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
@IgorMinar IgorMinar fix($compile): attribute bindings should not break due to terminal di…
…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 #4525
Closes #4528
Closes #4649
2d29628
@jamesdaily jamesdaily added a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
@IgorMinar IgorMinar fix($compile): attribute bindings should not break due to terminal di…
…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 #4525
Closes #4528
Closes #4649
70c0922
@jesselpalmer jesselpalmer pushed a commit that referenced this issue Sep 24, 2014
@IgorMinar IgorMinar fix($compile): attribute bindings should not break due to terminal di…
…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 #4525
Closes #4528
Closes #4649
c15374f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment