Get 2024 Templates Mega Bundle!$1000 worth of 19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets for just $99
Get for 99$

Angular metronic error if upgrade


Not sure but when upgrading the target and module to ES2022 I recieve this error. Will this be a future fix. This error happens after you login. but if I leave it out of the box with es2017, module es2020 and lib 2018

AVAST_PAM_inputicon_0 not found
paramHandler @ content.js:8919
vendor.js:39150 ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'firstChild')
TypeError: Cannot read properties of undefined (reading 'firstChild')
at LayoutService.getBaseLayoutTypeFromRouteOrLocalStorage (src_app__metronic_layout_index_ts-src_app__metronic_layout_layout_module_ts-src_app__metronic-5e1dbc.js:3972:43)
at new LayoutService (src_app__metronic_layout_index_ts-src_app__metronic_layout_layout_module_ts-src_app__metronic-5e1dbc.js:3919:235)
at Object.LayoutService_Factory [as factory] (src_app__metronic_layout_index_ts-src_app__metronic_layout_layout_module_ts-src_app__metronic-5e1dbc.js:4045:10)
at R3Injector.hydrate (vendor.js:38786:29)
at R3Injector.get (vendor.js:38687:23)
at injectInjectorOnly (vendor.js:31598:29)
at Module.ɵɵinject (vendor.js:31602:59)
at Object.LayoutInitService_Factory [as factory] (src_app__metronic_layout_index_ts-src_app__metronic_layout_layout_module_ts-src_app__metronic-5e1dbc.js:3839:93)
at R3Injector.hydrate (vendor.js:38786:29)
at R3Injector.get (vendor.js:38687:23)
at resolvePromise (polyfills.js:8462:19)
at resolvePromise (polyfills.js:8415:9)
at polyfills.js:8523:9
at _ZoneDelegate.invokeTask (polyfills.js:7673:171)
at vendor.js:54250:49
at AsyncStackTaggingZoneSpec.onInvokeTask (vendor.js:54250:30)
at _ZoneDelegate.invokeTask (polyfills.js:7673:54)
at Object.onInvokeTask (vendor.js:54552:25)
at _ZoneDelegate.invokeTask (polyfills.js:7673:54)
at Zone.runTask (polyfills.js:7475:37)
handleError @ vendor.js:39150
VM38:3 Uncaught TypeError: Cannot read properties of undefined (reading '_avast_submit')
at _submitInjector (<anonymous>:3:16)
at <anonymous>:31:9
content.js:7860 Failed to fetch service name 419


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (2)


Hi,

You can add the following lines to your tsconfig.json file:


"target": "es2022",
"module": "es2022",


By default, this should work for existing codes.

To resolve the issue, you can edit the following file:
/angular/demo1/src/app/_metronic/layout/core/layout.service.ts

In the file, you can add a ? after this.activatedRoute to make it optional. So the line of code should look like this:


const routeData = this.activatedRoute?.firstChild?.snapshot?.data;


This will ensure that the firstChildproperty is only accessed if this.activatedRoute is not null or undefined. Give it a try and let me know if it works.

Thanks



warning msg
TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version
and features use the Browerslist configuration. For more information, see https://angular.io/guide/build#configuring-browser-compatibility


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(