title: Access javascript variable in component in Angular 5
body: <p>I have a js file in my Angular application, data.js . This js file has some variables declared in it, something like below.  </p>
  
  <pre><code> var data = 'test'
  </code></pre>
  
  <p>Now I have to access these variables and their values in my component (app.component.ts).  </p>
  
  <p>I read some where that declaring them as exports make them into modules and those can be accessed anywhere, But I'm not sure how this can be done.  </p>
  
  <p>This is the structure of my application. I have data.js in assets->js folder.I need to modify the variable value in app.component.ts. </p>
  
  <p><a href="https://i.stack.imgur.com/Wx0VX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wx0VX.png" alt="enter image description here"></a></p>
  
  <p>I'm very new to Angular. Is this even possible?</p>