I need to update from an Angular project a variable from external javascript file
First I import the variable in my Angular component, and then I try to update it but I don't know how to do it
Little example of my Angular component:
import { Component } from '@angular/core';
import { externalText } from './external.js';
...
export class AppComponent {
myText = externalText;
changeText() {
// This works, but I need to update the variable from external file directly
this.myText = 'Text updated'
// I need something like this
// externalText = 'Text updated'
}
}
I create this Stackblitz with an example:
https://stackblitz.com/edit/angular-hczxhh
Expected: be able to update the information in the Javascript file from my Angular component
PHP, NodeJS,.NETetc. to save something in a file.ts or jsonly you can't do this