如何检查角度是否正确加载 [英] How to check if angular is loaded correctly
本文介绍了如何检查角度是否正确加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我想从 CDN 引用 angularjs,但我也希望在对 CDN 的调用失败的情况下进行回退,例如指向本地 js 文件.说到 JQuery,我见过一些例子,你会在 javascript 中做这样的事情:
Let's say that I want to reference angularjs from a CDN but I would also like a fallback in case the call to the CDN fails, e.g. pointing to a local js-file. When it comes to JQuery I have seen examples where you would do something like this in javascript:
if(typeof jQuery == 'undefined') {
....
}
我可以为 angularjs 做类似的事情吗?
Is there anything similar for angularjs I can do?
推荐答案
if(typeof angular == 'undefined') {
....
}
这篇关于如何检查角度是否正确加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文