我在angular 5项目中使用的是javascript库。如果我在.js文件中定义了全局变量,那么从我的.ts文件访问该全局变量的方法是什么?
Probably not the nicest approach, but you can always just define it on the window
object in javascript and then inside Angular read out the same window
object.
Or use localStorage
/ sessionStorage
setItem()
/ getItem()
for it but that will mean the value is retained between session or page refresh
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.