Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

KTUtil is not defined


Hi;
I use metronic 8 html version demo35 implemention to my angular 15 project and js imported after error "KTUtil is not defined"

can you help me for this problem
Thanks Keen Team.






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 (6)


i have Keen 3 admin theme, how can i do keen 3 admin theme implemention to angular 15, docs or video ?



Hi,

You need to make sure that the required JavaScript file, util.js, is included and properly loaded in your project.

Confirm that the util.js file is present in the correct location within your project's file structure. The original file is located in thesrc/js/components directory.


Thanks



"util.js" not included "demo35/dist/assets/..." in Metronic8 HTML Version "demo35"
In which folder will I copy the "util.js" file?



Hi,

If you are using the compiled files from the Metronic 8 HTML version demo35, the KTUtil library should already be included in the bundled filejs/scripts.bundle.js. Make sure you have imported this JavaScript file into your project.

Thanks



Another approach to define the KTUtil constant for an external library in an Angular project. Here's how you can do it:

Open the typings.d.ts file located in the src directory of your Angular project.
Add the following declaration to the file:


declare const KTUtil: any;


Please note that the typings.d.ts file is a common place to declare custom types or interfaces in an Angular project.

Thanks



Did you find a solution for this?

I'm having a very similar issue with the FormValidation library.
In my case KTUtil is defined, but I get this error:
Uncaught TypeError: KTUtil.onDOMContentLoaded is not a function

I made sure that the js/scripts.bundle.js file is imported in the project right above the file that's causing the error.


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  :(