Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabs title and content broken when using *ngFor #1052

Closed
rubenlg opened this issue Aug 15, 2016 · 5 comments
Closed

Tabs title and content broken when using *ngFor #1052

rubenlg opened this issue Aug 15, 2016 · 5 comments
Assignees
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful

Comments

@rubenlg
Copy link

rubenlg commented Aug 15, 2016

Bug, feature request, or proposal:

Here is a plunker based on the template provided on the root README.md:
http://plnkr.co/edit/CFJy3QkubNIzlm6ZUvzn?p=preview

What is the expected behavior?

Tabs labels are always visible, regardless of whether they are static or dynamic. Content is visible for the current tab.

What is the current behavior?

Only static tab labels are visible (i.e. the last tab) until you click on one of them. No content is visible, not even for the static tab.
If I change the CSS for ".md-tab-body[_ngcontent-nxk-3]" to drop the "display: none" rule from the chrome inspector, then I can see the content for the static tab, but for dynamic tabs I have to click twice to see their content.

What are the steps to reproduce?

http://plnkr.co/edit/CFJy3QkubNIzlm6ZUvzn?p=preview (based on your template)

What is the use-case or motivation for changing an existing behavior?

Make tabs work when generated dynamically via ngFor.

Which versions of Angular, Material, OS, browsers are affected?

Not sure, whatever you bundle on your plunker template.

Is there anything else we should know?

Part of the issues are potentially related to #957, although my plunker exposes a few other issues.

@jelbourn jelbourn self-assigned this Aug 16, 2016
@jelbourn jelbourn added the P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful label Aug 16, 2016
@FernandoFigueroa
Copy link

Posting this here since it helped me to bypass a bug that got me stuck for a couple of hours. I had a similar error while testing a component that implemented *ngFor generated tabs, the label and content were not displayed until i called the click method in the active tab:

it('should render the tabs section', fakeAsync(() => {
builder.createAsync(TestComponent).then((fixture: ComponentFixture<TestComponent>) => {
fixture.detectChanges();
tick();
fixture.debugElement.nativeElement.querySelector('.md-active').click();
fixture.detectChanges();
});
}));

Also, had to use fakeAsync + tick to get it going, really don't know why either.

@jelbourn
Copy link
Member

jelbourn commented Sep 7, 2016

This should be fixed in md-tabs by #1079

@jelbourn jelbourn closed this as completed Sep 7, 2016
@stefanofalasca
Copy link

I still have this problem. md-tab not work creating it dynamically, like this:

<md-tab [label]="item.label" *ngFor="let item of items">

@agent0
Copy link

agent0 commented Jun 20, 2017

A similar Problem occurs when defining Tabs inside a display:none div and then changing to visible. The headers are shown but the active tab indicator is not.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful
Projects
None yet
Development

No branches or pull requests

5 participants