How can I add a javascript file in a project of angular 6?

0

My problem is how to add a JavaScript file to use it within my project, and try to add it to the assets folder and it does not work, the following appears:

  

Uncaught ReferenceError: edit is not defined
      at HTMLButtonElement.onclick ((index): 13)

My code is:

<!doctype html>

<html lang="en">

<head>
  <meta charset="utf-8">

<script src="../assets/jquery-1.7.2.min.js" type="text/javascript"></script>

<script src="../assets/script.js" type="text/javascript"></script>

  <title>Intento</title>

  <base href="/">


  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link rel="icon" type="image/x-icon" href="favicon.ico">

</head>

<body>

  <app-root></app-root>

<script type="text/javascript" src="runtime.js"></script><script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="styles.js"></script><script type="text/javascript" src="vendor.js"></script><script type="text/javascript" src="main.js"></script>

</body>

</html>

The problem is that I do not know how instanciar the JavaScript file.

    
asked by r0b0f0sn0w 21.05.2018 в 23:08
source

1 answer

0

The same thing happened to me. I put it in the Local State of the project. In that folder you can store any type of data for the application to pull from that folder. My folder is located in this route:

C: \ Users \ Windows user \ AppData \ Local \ Packages ... \ LocalState

In the app, you refer to this folder in this way:

<script type="text/javascript" src="ms-appdata:///localPackages/.../LocalState/.../fichero.js"></script>
    
answered by 22.05.2018 / 13:00
source