bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

The ui.bootstrap.tabs when using ng-repeat

Open lunhat79 opened this issue 10 years ago • 6 comments

Bug description:

The tab.index of UibTabsetController.tabs array is not set after the tab being destroy.

That cause the index of UibTabsetController.tabs is not correct with the index at View(html).

Link to minimally-working plunker that reproduces the issue:

http://plnkr.co/edit/kal8TDVoRLT7417GOLXd

Version of Angular, UIBS, and Bootstrap

Angular: version 1.5.0

Bootstrap: ui-bootstrap-tpls-1.2.4.js

lunhat79 avatar Mar 19 '16 05:03 lunhat79

At first glance, this looks like a bug.

icfantv avatar Mar 19 '16 05:03 icfantv

It is because the index at view is changed, but the index at tabs is not updated. I think the Index attribute must be watched and update to the tabs.

lunhat79 avatar Mar 19 '16 06:03 lunhat79

Relying on dynamic index values leads to a world of pain - I'd recommend against doing so. I'm taking a look at potentially allowing dynamic indices, but it looks like it causes far uglier bugs unsurprisingly.

This may potentially be rejected as a not supported case, will look into this a little further.

wesleycho avatar Mar 19 '16 07:03 wesleycho

After spending some time working on this and thinking on it, I am going to close this as won't fix. Relying on tab index values being dynamic & not unique is a use case that has fundamental problems when it comes to active state management when tabs are removed and added.

wesleycho avatar Mar 19 '16 14:03 wesleycho

Wesley Cho. The document say the index is UNIQUE. So i think we could solve the problem by determine the index is unique and the model (scope) is change following the Index.

lunhat79 avatar Mar 19 '16 18:03 lunhat79

After removing item from tab creating deep copy of array will fix this issue.

Working link : http://plnkr.co/edit/FRqvpsRGk6HxdrqdTKx6?p=preview

krishna-agarwal avatar Oct 06 '16 06:10 krishna-agarwal