gpt4 book ai didi

javascript - Karma + ui-router 失败 : Cannot read property 'isDefined' of undefined

转载 作者:行者123 更新时间:2023-12-01 15:48:27 25 4
gpt4 key购买 nike

我在 Angular 项目中使用 ui-router。为了进行测试,我使用了 KarmaJasmine

运行 Karma 时,出现以下错误:

Uncaught TypeError: Cannot read property 'isDefined' of undefined
at /Applications/MAMP/htdocs/examtesting/js/vendor/angular-ui-router.min.js:7

我如何克服这个问题?

这是整个终端:

patrickreck@Patricks-MacBook-Pro /A/M/h/examtesting> karma start karma.conf.js 
INFO [karma]: Karma v0.12.16 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 35.0.1916 (Mac OS X 10.9.2)]: Connected on socket xtivwYEP-4sBQAeAlsMl with id 73870853
Chrome 35.0.1916 (Mac OS X 10.9.2) ERROR
Uncaught TypeError: Cannot read property 'isDefined' of undefined
at /Applications/MAMP/htdocs/examtesting/js/vendor/angular-ui-router.min.js:7

最佳答案

isDefined 可能是 angular 变量的属性。所以也许 Angular 库没有被正确加载。

你能发布 Karma 配置文件吗? Angular 需要在 angular-ui-router.js 之前加载。

关于javascript - Karma + ui-router 失败 : Cannot read property 'isDefined' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23894888/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com