Upgrading @angular/platform-browser-dynamic 12 to 13
Breaking12.2.17 → 13.4.0Breaking18Platform7Deprecated12New47Changed18Fixed152Other4
BreakingUpgrade verdict
14 breaking changes and 7 platform requirement changes.
In plain terms
- Tests that fake browser navigation behave differently now: going to a URL no longer fires a popstate event, and the hash-change helper fires two events instead of one.
- Cancelling a navigation no longer rewrites the address bar, which removes URL flicker but changes behavior for hybrid AngularJS apps.
- Code that imported a helper class called WrappedValue from Angular core will break; there is no replacement, so remove its usage.
- URLs with a question mark inside a query value are now parsed correctly rather than truncated.
Must act Top 5 of 33 that need code or config changes
Node.js requirement changed in 13.0.0-next.13: ^12.14.1 || >=14.0.0 → ^12.20.0 || ^14.15.0 || >=16.10.0.
What you must change
Breaking14
SpyLocation used by RouterTestingModule no longer emits popstate on Location.go, and simulateHashChange now triggers both hashchange and popstate.
SpyLocationRouterTestingModuleLocation.gosimulateHashChangeRouter no longer replaces the browser URL when a new navigation cancels an ongoing one.
navigationIdNavigationCancellocation.replaceStateSpyLocationurlChangesWrappedValue can no longer be imported from @angular/core, which may cause compile or runtime failures in outdated libraries.
WrappedValue@angular/coreDefault url serializer now correctly keeps question marks inside query parameter values instead of dropping everything after them.
routerLink no longer treats null and undefined as empty string, and href is now an attribute binding returning the full native URL.
routerLinkHostBindingDebugElement.properties['href']RouterLinkRoute.loadChildren no longer accepts a string; NgModuleFactoryLoader, SystemJsNgModuleFactoryLoader, SpyNgModuleFactoryLoader and DeprecatedLoadChildren are removed.
Route.loadChildrenNgModuleFactoryLoaderSystemJsNgModuleFactoryLoaderSpyNgModuleFactoryLoaderDeprecatedLoadChildrensetupTestingRouterRemoves support for the loadChildren string syntax.
loadChildrenRemoves support for the deprecated WrappedValue.
WrappedValueRemoves the ng-add schematic from @angular/elements.
ng-addRemoves the incorrect @angular/platform-browser peer dependency from @angular/elements.
@angular/platform-browserHardens attribute and property binding rules for <iframe> elements, which may require updates to existing iframe usages.
<iframe>Hardens attribute and property binding rules for <iframe> elements.
<iframe>SwUpdate#activateUpdate and SwUpdate#checkForUpdate now return Promise<boolean>.
SwUpdate#activateUpdateSwUpdate#checkForUpdatePromise<boolean>Introduces FormControlStatus type, narrowing AbstractControl.status to it and statusChanges to Observable<FormControlStatus>.
FormControlStatusAbstractControl.statusstatusChangesPlatform7
Adds support for TypeScript 4.5.
Adds support for TypeScript 4.5.
TypeScript versions older than 4.4.2 are no longer supported.
NodeJS versions older than v12.20.0 are no longer supported due to NodeJS package exports with subpath patterns.
Drops support for TypeScript 4.2 and 4.3.
Adds support for TypeScript 4.4.
Updates the supported Node.js version range to include v16.
Deprecations to plan for
Deprecated12
Deprecates the CachedResourceLoader and RESOURCE_CACHE_PROVIDER symbols, which are no longer needed since Ivy.
CachedResourceLoaderRESOURCE_CACHE_PROVIDERDeprecates the ComponentFactory and ComponentFactoryResolver classes, since Ivy does not require resolving component factories.
ComponentFactoryComponentFactoryResolverDeprecates the unused CompilerOptions.useJit and CompilerOptions.missingTranslation config options, which have no effect since Ivy.
CompilerOptions.useJitCompilerOptions.missingTranslationDeprecates the tap operator subscribe signature with separate callback arguments in favor of an observer argument.
tapDeprecates
downgradeModule calls that use NgModule factories; use NgModule class based calls instead.downgradeModuleTestRequest from @angular/common/http/testing no longer accepts ErrorEvent for simulated XHR errors; pass ProgressEvent instead.TestRequestErrorEventProgressEventrenderModuleFactory in @angular/platform-server is deprecated; use renderModule instead.
renderModuleFactoryrenderModule@angular/platform-serverSwUpdate#activated observable is deprecated; use the return value of SwUpdate#activateUpdate instead.
SwUpdate#activatedSwUpdate#activateUpdateSwUpdate#availalbe observable is deprecated; use SwUpdate#versionUpdates with VersionReadyEvent instead.
SwUpdate#availalbeSwUpdate#versionUpdatesVersionReadyEventDeprecates ViewEngine-based renderModuleFactory.
renderModuleFactoryDeprecates the SwUpdate#activated observable.
SwUpdate#activatedSwUpdate#activateUpdate()Deprecates the SwUpdate#availalbe observable.
SwUpdate#availalbeSwUpdate#versionUpdatesVersionReadyEventAPI changes
Generated by DepDelta from published .d.ts files. Not mixed with prose notes.
- removed:
class ɵCompilerImpl implements Compiler - removed:
class ɵResourceLoaderImpl extends ResourceLoader - removed:
class ɵangular_packages_platform_browser_dynamic_platform_browser_dynamic_a extends ResourceLoader - removed:
const ɵCOMPILER_PROVIDERS__POST_R3__: StaticProvider[] - removed:
constructor ɵCompilerImpl(injector: Injector, _metadataResolver: CompileMetadataResolver, templateParser: TemplateParser, styleCompiler: StyleCompiler, viewCompiler: ViewCompiler, ngModuleCompiler: NgModuleCompiler, summaryResolver: SummaryResolver<Type<any>>, compileReflector: CompileReflector, jitEvaluator: JitEvaluator, compilerConfig: CompilerConfig, console: ɵConsole) - removed:
constructor ɵangular_packages_platform_browser_dynamic_platform_browser_dynamic_a() - removed:
method ɵCompilerImpl.clearCache(): void - removed:
method ɵCompilerImpl.clearCacheFor(type: Type<any>): void - removed:
method ɵCompilerImpl.compileModuleAndAllComponentsAsync<T>(moduleType: Type<T>): Promise<ModuleWithComponentFactories<T>> - removed:
method ɵCompilerImpl.compileModuleAndAllComponentsSync<T>(moduleType: Type<T>): ModuleWithComponentFactories<T> - removed:
method ɵCompilerImpl.compileModuleAsync<T>(moduleType: Type<T>): Promise<NgModuleFactory<T>> - removed:
method ɵCompilerImpl.compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T> - removed:
method ɵCompilerImpl.getComponentFactory<T>(component: Type<T>): ComponentFactory<T> - removed:
method ɵCompilerImpl.getModuleId(moduleType: Type<any>): string | undefined - removed:
method ɵCompilerImpl.hasAotSummary(ref: Type<any>): boolean - removed:
method ɵCompilerImpl.loadAotSummaries(summaries: () => any[]): void - removed:
method ɵResourceLoaderImpl.get(url: string): Promise<string> - removed:
method ɵangular_packages_platform_browser_dynamic_platform_browser_dynamic_a.get(url: string): Promise<string> - removed:
readonly property ɵCompilerImpl.injector: Injector
- removed:
export * from './testing/testing'
- removed:
class ɵangular_packages_platform_browser_dynamic_testing_testing_b implements ɵTestingCompilerFactory - removed:
const ɵangular_packages_platform_browser_dynamic_testing_testing_a: StaticProvider[] - removed:
constructor ɵangular_packages_platform_browser_dynamic_testing_testing_b(_injector: Injector, _compilerFactory: CompilerFactory) - removed:
method ɵangular_packages_platform_browser_dynamic_testing_testing_b.createTestingCompiler(options: CompilerOptions[]): ɵTestingCompiler - added:
static property BrowserDynamicTestingModule.ɵfac: i0.ɵɵFactoryDeclaration<BrowserDynamicTestingModule, never> - added:
static property BrowserDynamicTestingModule.ɵinj: i0.ɵɵInjectorDeclaration<BrowserDynamicTestingModule> - added:
static property BrowserDynamicTestingModule.ɵmod: i0.ɵɵNgModuleDeclaration<BrowserDynamicTestingModule, never, never, [typeof i1.BrowserTestingModule]> - added:
static property ɵDOMTestComponentRenderer.ɵfac: i0.ɵɵFactoryDeclaration<ɵDOMTestComponentRenderer, never> - added:
static property ɵDOMTestComponentRenderer.ɵprov: i0.ɵɵInjectableDeclaration<ɵDOMTestComponentRenderer>