Skip to content

Commit a8c8715

Browse files
committed
fix: use static counter for id
Signed-off-by: Akshat Patel <[email protected]>
1 parent e66b60d commit a8c8715

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/tabs/tab.component.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import {
88
HostBinding
99
} from "@angular/core";
1010

11-
let nextId = 0;
12-
1311
/**
1412
* The `Tab` component is a child of the `Tabs` component.
1513
* It represents one `Tab` item and its content within a panel of other `Tab` items.
@@ -70,6 +68,7 @@ let nextId = 0;
7068
`
7169
})
7270
export class Tab implements OnInit {
71+
private static counter = 0;
7372
/**
7473
* Boolean value reflects if the `Tab` is using a custom template for the heading.
7574
* Default value is false.
@@ -102,11 +101,10 @@ export class Tab implements OnInit {
102101
@Input() disabled = false;
103102

104103
@Input() tabIndex = 0;
105-
// do we need id's?
106104
/**
107105
* Sets the id of the `Tab`. Will be uniquely generated if not provided.
108106
*/
109-
@Input() id = `n-tab-${nextId++}`;
107+
@Input() id = `n-tab-${Tab.counter++}`;
110108
/**
111109
* Set to true to have Tab items cached and not reloaded on tab switching.
112110
*/

0 commit comments

Comments
 (0)