components icon indicating copy to clipboard operation
components copied to clipboard

md-ink-bar size not change, when screen width changed (responsive)

Open zealitude opened this issue 9 years ago • 4 comments

Bug, feature request, or proposal:

Bug

What is the expected behavior?

md-ink-bar will auto change the size after screen width changed md-ink-bar size should follow tab label width change

What is the current behavior?

md-ink-bar will do nothing

What are the steps to reproduce?

  1. create a width large enough tab (responsive situation)
  2. change the screen width thus the tab label width change

Providing a Plunker (or similar) is the best way to get the team to see your issue. http://plnkr.co/edit/x83f1Qas5qACU8rb4pNi?p=preview

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

handle responsive

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

2.0.0-beta.2

Is there anything else we should know?

bug only happen in 2.0.0-beta.2 no bug found in 2.0.0-beta.1

zealitude avatar Mar 07 '17 01:03 zealitude

Same problem , had to do it manually ....

hamzaOp avatar Mar 07 '17 12:03 hamzaOp

This is what I currently use to overcome this issue. It is working fine while in development, however I would not go live with it. It looks like I have: @angular/[email protected]

import {Component, OnInit, AfterViewInit, ViewChild} from '@angular/core';
import {MdTabNavBar} from '@angular/material';

@Component({
  selector: 'app-nav',
  template: `
    <nav #d md-tab-nav-bar (load)="updateInkBarSize()">
      <a md-tab-link routerLink="tab1" routerLinkActive #rla1="routerLinkActive"
         [active]="rla1.isActive">Sales</a>
      <a md-tab-link routerLink="tab2" routerLinkActive #rla2="routerLinkActive"
         [active]="rla2.isActive">Purchases</a>
    </nav>
    <router-outlet></router-outlet>
  `
})
export class NavBarComponent implements OnInit, AfterViewInit {
  @ViewChild(MdTabNavBar) navBar: MdTabNavBar;

  constructor() {
  }

  ngOnInit() {
    window.onresize = () => this.updateInkBarSize();

  }

  ngAfterViewInit() {
    this.updateInkBarSize();
  }

  updateInkBarSize() {
    if(this.navBar && this.navBar._activeLinkElement) {
      this.navBar._inkBar.alignToElement(this.navBar._activeLinkElement.nativeElement);
    }
  }
}

sorvant avatar Mar 09 '17 14:03 sorvant

Dupe of #3044

jelbourn avatar Apr 09 '17 20:04 jelbourn

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.