HTML:
<div id="obj"></div>
在 jQuery 中:
var obj = $('#obj');
obj instanceof jQuery;
'true'
所以,我假设
angular.module('app', []) instanceof angular.module()
是真的..
相反我得到:
错误:[$injector:nomod ] http://errors.angularjs.org/1.3.0-beta.17/$injector/nomod?p0=undefined
...好的,所以尝试:
app instanceof angular.module
false
app.isPrototypeOf(angular.module)
false
app.isPrototypeOf(angular)
false
我在这里想念什么?如何检查对象是否是 angular 的实例?
其他令人困惑的事情:
typeof angular
"object"
typeof app
"object"
app instanceof angular
类型错误:在 instanceof 检查中期待一个函数,但得到了#
^^ 如果 angular 是一个对象而 app 是一个对象,为什么它需要一个函数?
Object.keys(app);
//returns
_configBlocks: Array[0]
_invokeQueue: Array[0]
_runBlocks: Array[0]
animation: function (){f[e||
config: function (){f[e||
constant: function (){f[e||
controller: function (){f[e||
directive: function (){f[e||
factory: function (){f[e||
filter: function (){f[e||
name: "app"
provider: function (){f[e||
requires: Array[0]
run: function (a){n.push(a);return this}
service: function (){f[e||
value: function (){f[e||
__proto__: Object
^^ .prototype 在哪里?如何确定对象是角度对象的实例?