Skip to content

Commit 716e08d

Browse files
committed
feat: make nativescript identify as browser in angular
This enables all the browser features like `@defer`, `afterRender` and `afterNextRender`, which are integral parts of new updates (including the angular router in the future) BREAKING CHANGES: Identifying as browser can have minor impact on existing libraries that use that to manipulate the DOM. So far, the usage inside angular itself is minimal enough that it shouldn't impact apps other than enabling previously mentioned features.
1 parent ad3be07 commit 716e08d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/angular/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"Angular"
1717
],
1818
"dependencies": {
19-
"@nativescript/zone-js": "^3.0.0"
19+
"@nativescript/zone-js": "^3.0.4"
2020
},
2121
"sideEffects": [
2222
"**/nativescript-angular-polyfills.mjs",

packages/angular/src/lib/platform-nativescript.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Type, Injector, CompilerOptions, PlatformRef, NgModuleFactory, NgModuleRef, EventEmitter, Sanitizer, InjectionToken, StaticProvider, createPlatformFactory, platformCore } from '@angular/core';
1+
import { Type, Injector, CompilerOptions, PlatformRef, NgModuleFactory, NgModuleRef, EventEmitter, Sanitizer, InjectionToken, StaticProvider, createPlatformFactory, platformCore, PLATFORM_ID } from '@angular/core';
22
import { DOCUMENT } from '@angular/common';
33
import { NativeScriptPlatformRefProxy } from './platform-ref';
44
import { AppHostView } from './app-host-view';
@@ -31,7 +31,7 @@ export class NativeScriptDocument {
3131
}
3232
}
3333

34-
export const COMMON_PROVIDERS = [defaultPageFactoryProvider, { provide: Sanitizer, useClass: NativeScriptSanitizer, deps: [] }, { provide: DOCUMENT, useClass: NativeScriptDocument, deps: [] }];
34+
export const COMMON_PROVIDERS = [defaultPageFactoryProvider, { provide: Sanitizer, useClass: NativeScriptSanitizer, deps: [] }, { provide: DOCUMENT, useClass: NativeScriptDocument, deps: [] }, { provide: PLATFORM_ID, useValue: 'browser' }];
3535

3636
export const platformNativeScript = createPlatformFactory(platformCore, 'nativescriptDynamic', COMMON_PROVIDERS);
3737

0 commit comments

Comments
 (0)