material icon indicating copy to clipboard operation
material copied to clipboard

md-tab problem with ng-repeat and md-on-select

Open djidel opened this issue 10 years ago • 4 comments

Having md-tab with ng-repeat and md-on-select. The problem occure when changing ng-repeat array.

Actual Behavior:

  • What is the issue? When ng-repeat array changes, md-on-select is triggered for some of the elements of the tabs.
  • What is the expected behavior? md-on-select should not be triggered.

CodePen

  • CodePen: http://codepen.io/djidel/pen/zKWEzG
  • Details: Clicking on any tab should result in console log with the tab label. Clicking on the button will replace the ng-repeat array, which will inveal the problem: getting console logs for some of the removed tabs.

Angular Versions:

  • Angular Version: 1.5.5
  • Angular Material Version: 1.1.1

Additional Information:

  • Browser Type: Chrome
  • Browser Version: 53
  • OS: Windows

djidel avatar Oct 09 '16 19:10 djidel

@topherfangio - sounds like a timing issue where the md-on-select expression trigger should be debounced.

ThomasBurleson avatar Oct 13 '16 12:10 ThomasBurleson

Hey Guys, I'm running into similar issue. Is the any work around for not to trigger the md-on-select with ng-repeat of tabs where the number of tabs dynamically change on events.

Thanks for the help!

hdevandla avatar Mar 03 '17 19:03 hdevandla

Hey, I'm not sure, but $scope.$watch('md-selected',your_listener_function) might be a work around.

djidel avatar Mar 03 '17 22:03 djidel

Thanks. I'm using ng-click instead of md-on-select. That seems to have fixed the issue.

hdevandla avatar Mar 04 '17 02:03 hdevandla