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

Transclude + ngClass = clone unexpected class #6751

Closed
maxisam opened this issue Mar 19, 2014 · 3 comments
Closed

Transclude + ngClass = clone unexpected class #6751

maxisam opened this issue Mar 19, 2014 · 3 comments

Comments

@maxisam
Copy link

maxisam commented Mar 19, 2014

This is a rare case and I am not 100% positive about my theory.

So let's say if there is a directive with transclude feature, and there is a ngClass in the transclude part, it will generate unexpected class during clone process. Because during clone process, transcludeFn(scope, function(clone) { }); , I think the clone part is compiled with the scope you feed. But if the data is not ready at that moment, the unexpected class will be generated. And unfortunately the unexpected class will be cloned as well, and there is no way it will be cleared by ngClass later.

Here is the example plunker
Another example this one is simpler.
You can inspect the icon in field4, and you will see there are 2 classes for it. It supposes to be one. The first one was generated during clone process.

I can walk around this issue but I wonder if we need to feed scope to transclude function, since it is likely the clone part will be compiled later with the scope you feed it. Why do we need to feed transclude scope then ?

@maxisam
Copy link
Author

maxisam commented May 6, 2014

edit note: It turns out there is a bug in transclude with IE. I put it in different issue here

There is another issue related to this one. In IE (All versions), none of the row is showing correctly. The data binding is not working correctly this way.

It seems like in the second example, data binding works fine in IE. So it might be just table

@petebacondarwin
Copy link
Contributor

Related to #7388

@maxisam
Copy link
Author

maxisam commented May 15, 2014

Actually there are 2 issues here. One is related to #7388 the other one is not. The 2nd post is the issue related to #7388. The first one is not. FYI, this is the reason why I used transclude.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants