Skip to content

Commit 4f01eff

Browse files
MKirovaMayaKirova
authored andcommitted
fix(igxGrid): Inject unique instances of the scroll sync service for IgxForOfDirective. Re-use same instances only when used in a Grid, where a common instance is injected in the Grid itself.
1 parent 710523f commit 4f01eff

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ export class IgxForOfContext<T> {
6868

6969
}
7070

71-
@Directive({ selector: '[igxFor][igxForOf]' })
71+
@Directive({ selector: '[igxFor][igxForOf]',
72+
providers: [ IgxForOfScrollSyncService ] })
7273
export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestroy, AfterViewInit {
7374

7475
/**

projects/igniteui-angular/src/lib/directives/for-of/for_of.sync.service.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ export class IgxForOfSyncService {
4848
}
4949
}
5050

51-
@Injectable({
52-
providedIn: 'root',
53-
})
51+
@Injectable()
5452
export class IgxForOfScrollSyncService {
5553
private _masterScroll: Map<string, VirtualHelperBaseDirective> = new Map<string, any>();
5654
public setScrollMaster(dir: string, scroll: VirtualHelperBaseDirective) {

0 commit comments

Comments
 (0)