I'm using the Ionic framework and I want to call a variable from a javascript file, but it returns undefined for the variable and prints the console inside the file.
javascript file:
console.log('Hi!')
var test = "Hello";
typescript file:
import * as testfile from "src/assets/js/customers"
export class CustomersPage implements OnInit {
test:any='j';
constructor (){
this.test= testfile.test;
console.log('Hello from typescript', this.test);
}
}
The Result
Hi
Hello from typescript undefined