mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
refactor(common): drop NullViewportScroller for client bundles (#59440)
In this commit, we replace the `isPlatformBrowser` runtime call with the `ngServerMode` in order to drop the `NullViewportScroller` for client bundles. PR Close #59440
This commit is contained in:
parent
205330d46a
commit
83bd63fa7c
1 changed files with 4 additions and 5 deletions
|
|
@ -6,10 +6,9 @@
|
|||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
import {inject, PLATFORM_ID, ɵɵdefineInjectable} from '@angular/core';
|
||||
import {inject, ɵɵdefineInjectable} from '@angular/core';
|
||||
|
||||
import {DOCUMENT} from './dom_tokens';
|
||||
import {isPlatformBrowser} from './platform_id';
|
||||
|
||||
/**
|
||||
* Defines a scroll position manager. Implemented by `BrowserViewportScroller`.
|
||||
|
|
@ -24,9 +23,9 @@ export abstract class ViewportScroller {
|
|||
token: ViewportScroller,
|
||||
providedIn: 'root',
|
||||
factory: () =>
|
||||
isPlatformBrowser(inject(PLATFORM_ID))
|
||||
? new BrowserViewportScroller(inject(DOCUMENT), window)
|
||||
: new NullViewportScroller(),
|
||||
typeof ngServerMode !== 'undefined' && ngServerMode
|
||||
? new NullViewportScroller()
|
||||
: new BrowserViewportScroller(inject(DOCUMENT), window),
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue