angular-ui / bootstrap

PLEASE READ THE PROJECT STATUS BELOW. Native AngularJS (Angular) directives for Bootstrap. Smaller footprint (20kB gzipped), no 3rd party JS dependencies (jQuery, bootstrap JS) required. Please read the README.md file before submitting an issue!
http://angular-ui.github.io/bootstrap/
MIT License
14.28k stars 6.73k forks source link

Tab heading transclusion breaks directive 'require' property #2190

Open Coridyn opened 10 years ago

Coridyn commented 10 years ago

I have found that the tabHeadingTransclude directive prevents required parent controllers from being passed through to directive link functions.

Here is an example showing the issue: http://plnkr.co/edit/GKUdOkkgsVKAGOLUpwBy?p=preview

I expect the showInheritedData directives inside the tab headings to show the text Inherited data= "this was inherited". However, they are showing Inherited data= "No inherited data available." because the directive link function doesn't receive the parent controller.

I think this problem occurs because the tabHeadingTransclude $watch expression executes after 'tab.$transcludeFn' method. This means the headingElement isn't on the DOM when Angular tries to check up the chain to resolve the directive's require attribute.

_Possible solution:_ I a fix for the tabHeadingTransclude directive that $compiles the headingElement content before appending it on the DOM: http://plnkr.co/edit/7BsaBEzMBUrNEt8yL2BN?p=preview

Is this an appropriate solution to this problem?

Thanks, -Coridyn

rvanbaalen commented 9 years ago

Can you confirm this is still an issue with UI Bootstrap 0.13 and Angular 1.3?

Coridyn commented 9 years ago

Hi, sorry about the delay in checking this.

Yes, I've confirmed that the issue still occurs in Angular 1.3 (and 1.4.1) and UI Bootstrap 0.13.

Here is the updated plunker I used to check the issue: http://plnkr.co/edit/otcWoroTMmVrj6IBZRLY?p=preview

wesleycho commented 9 years ago

How the transclusion happens currently with tabs needs to be refactored - it is not properly handled.

icfantv commented 8 years ago

@segevofer, please do not only add +1 to issues with no other comments. doing so adds no intrinsic value and serves to only clutter up the thread.

wesleycho commented 8 years ago

Just noting, we now have a path to fix this, but this requires breaking all support for angular prior to 1.5. Scheduling this for 3.0.0.