如何检查是否角度是否正确装入 [英] How to check if angular is loaded correctly
本文介绍了如何检查是否角度是否正确装入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
让我们说,我想从CDN引用angularjs但我也想万一后备呼叫转移到CDN失败,例如指向本地JS文件。当涉及到JQuery的我所看到的例子,你会做的JavaScript是这样的:
如果(typeof运算jQuery的=='不确定'){
....
}
有什么类似的angularjs我能做什么?
解决方案
如果(typeof运算角度==未定义){
....
}
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') {
....
}
Is there anything similar for angularjs I can do?
解决方案
if(typeof angular == 'undefined') {
....
}
这篇关于如何检查是否角度是否正确装入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文