material icon indicating copy to clipboard operation
material copied to clipboard

md-tabs with ng-repeat with no elements gives an error

Open dmcbcc opened this issue 11 years ago • 1 comments

My application has a set of md-tabs that is populated via $http service, so for a short time it has no elements. After the service loads, I set a new index for md-tabs and it throws this error:

Error: tab is undefined updateInkBarStyles@http://rawgit.com/angular/bower-material/master/angular-material.js:12718:9 handleSelectedIndexChange@http://rawgit.com/angular/bower-material/master/angular-material.js:12660:5 Pe/this.$get</n.prototype.$digest@http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:123:354 Pe/this.$get</n.prototype.$apply@http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:126:291 l@http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:81:238 M@http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:85:342 wf/</F.onload@http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:86:367

Specifically, this line is the error: left = tab.offsetLeft, the line before it sets the tab is what is not getting set: tab = elements.tabs[index],

I should also note that I saw this same bit of code (setting the tab in the same way) in another part of the code, so if you fix this, you might need to fix that as well.

Plunkr here: http://plnkr.co/edit/zKLspJesNoqlYMB10URj

The error occurs when you click on the empty bar.

dmcbcc avatar May 01 '15 19:05 dmcbcc

This error is no longer occurring on the latest build from rawgit. Thank you.

dmcbcc avatar May 04 '15 13:05 dmcbcc