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

ng-if breaks when used inside a custom directive together with templateUrl #7183

Closed
Schweigi opened this issue Apr 21, 2014 · 8 comments
Closed

Comments

@Schweigi
Copy link

ng-if does not work when used inside a custom directive and the template is specified using templateUrl. When the custom directive template is specified directly using the "template" parameter then there is no problem. Additionally this problems happens only if the custom directive is inside a ng-repeat.

The bug is reproducible with Angular 1.2.16. A possible workaround is to use ng-show instead.

Sample: http://codepen.io/anon/pen/mdFAo/?editors=101

@IgorMinar
Copy link
Contributor

it's also related to the directive using 'replace:true'

@IgorMinar IgorMinar added this to the 1.3.0 milestone Apr 21, 2014
@shahata
Copy link
Contributor

shahata commented Apr 22, 2014

it's also related to the template being loaded from $templateCache and the http success callback being invoked slightly before the delayed link in the digest cycle. didn't have time to debug further :(

here's a bit less complicated reproduce example: http://plnkr.co/edit/IboruW7Dku1hTnPOFMI2?p=preview

@petebacondarwin petebacondarwin modified the milestones: 1.3.0-beta.9, 1.3.0 May 12, 2014
@petebacondarwin petebacondarwin self-assigned this May 12, 2014
@petebacondarwin
Copy link
Contributor

This is not fixed by #7387

@btford btford modified the milestones: 1.3.0-beta.10, 1.3.0-beta.9 May 16, 2014
@btford btford modified the milestones: 1.3.0-beta.11, 1.3.0-beta.10 May 23, 2014
@petebacondarwin
Copy link
Contributor

@shahata's plunker is still broken on master but it doesn't break if you wrap the cached template contents (i.e. the bit with the ng-if) in a div: http://plnkr.co/edit/IboruW7Dku1hTnPOFMI2?p=preview

@IgorMinar
Copy link
Contributor

@petebacondarwin are you looking into this one?

@petebacondarwin
Copy link
Contributor

I've spent some time on it with no progress so far. Could benefit from some
pairing
On 9 Jun 2014 20:44, "Igor Minar" notifications@github.com wrote:

@petebacondarwin https://github.com/petebacondarwin are you looking
into this one?


Reply to this email directly or view it on GitHub
#7183 (comment).

@caitp
Copy link
Contributor

caitp commented Jun 9, 2014

@petebacondarwin I enjoy hacking on the compiler, so if you need some help with it don't hesitate to ask. Unless anyone else is in your timezone at the moment, in which case they'd probably be better.

petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jun 10, 2014
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jun 12, 2014
caitp pushed a commit to caitp/angular.js that referenced this issue Jun 12, 2014
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jun 13, 2014
If a "replace" directive has an async template, which contains a transclusion
directive at its root node, then outer transclusions were failing to be
passed to this directive.  An example would be uses of `ngIf` inside and
outside the template.

Collaborated with @caitp

Closes angular#7183
Closes £7772
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jun 13, 2014
If a "replace" directive has an async template, which contains a transclusion
directive at its root node, then outer transclusions were failing to be
passed to this directive.  An example would be uses of `ngIf` inside and
outside the template.

Collaborated with @caitp

Closes angular#7183
Closes £7772
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jun 13, 2014
If a "replace" directive has an async template, which contains a transclusion
directive at its root node, then outer transclusions were failing to be
passed to this directive.  An example would be uses of `ngIf` inside and
outside the template.

Collaborated with @caitp

Closes angular#7183
Closes £7772
@petebacondarwin
Copy link
Contributor

caitp pushed a commit to caitp/angular.js that referenced this issue Jun 13, 2014
If a "replace" directive has an async template, which contains a transclusion
directive at its root node, then outer transclusions were failing to be
passed to this directive.  An example would be uses of `ngIf` inside and
outside the template.

Collaborated with @caitp

Closes angular#7183
Closes angular#7772
petebacondarwin added a commit that referenced this issue Jun 13, 2014
If a "replace" directive has an async template, which contains a transclusion
directive at its root node, then outer transclusions were failing to be
passed to this directive.  An example would be uses of `ngIf` inside and
outside the template.

Collaborated with @caitp

Closes #7183
Closes #7772
nistormihai added a commit to liveblog/liveblog that referenced this issue Dec 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.