Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Tabset breaks require ^ #524

Closed
glebm opened this issue Jun 15, 2013 · 5 comments
Closed

Tabset breaks require ^ #524

glebm opened this issue Jun 15, 2013 · 5 comments

Comments

@glebm
Copy link

glebm commented Jun 15, 2013

If I have this:

<parent>
  <tabset>
    <tab heading="Tab">          
      <child></child>          
    </tab>        
  </tabset>
</parent>

Then child can't access parent controller.
Here is a simple demo: http://plnkr.co/edit/ts0TsLu1xdRQxFGc9B8e?p=preview

Any idea on why this might be happening?

@sjmcpherson
Copy link

+1

@ajoslin
Copy link
Contributor

ajoslin commented Jun 26, 2013

Found it after some tinkering.

The child doesn't have a parent() so it doesn't know how to fetch the controller by looking up parent elements.

This is because when we append the tab content in https://github.com/angular-ui/bootstrap/blob/master/src/tabs/tabs.js#L291, we don't $compile it again so it never gets 'connected'.

It can be fixed by just $compiling the tab content element after it gets appended. Check line 292 of tabs.js here: http://plnkr.co/edit/8rRQqVvo8jrDjn5MoQxe?p=preview

I'll push it with a test later.

@rosslavery
Copy link

Didn't want to double-post the info, but I added some information in #574 after it was closed as to why it seems like the $compile(tab.contentElement)(scope); fix isn't quite working.

ajoslin added a commit that referenced this issue Jun 28, 2013
* Make tab contents be compiled into outer scope after being appended to
tab-pane elements.
@ajoslin
Copy link
Contributor

ajoslin commented Jun 28, 2013

Fixed in be7ecff :-)

@ajoslin ajoslin closed this as completed Jun 28, 2013
@rosslavery
Copy link

Hey @ajoslin, this fix doesn't seem to have fixed #574.

That issue was originally closed because the causes were thought to be the same, but I guess they aren't :/

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

4 participants