我已经为 angularjs 包含了 ui-router.js 。但不知何故,我没有让它与 requirejs 一起工作。
require.config
baseUrl:"/Scripts/app"
paths :
jquery : "libs/jquery/jquery-2.0.3"
bootstrap : "libs/bootstrap/bootstrap"
angular : "libs/angular/angular"
domReady : "libs/requirejs/domReady"
blockui : "libs/jquery.blockUI"
"ui-router" : "libs/angular/angular-ui-router"
"angular-resource" : "libs/angular/angular-resource"
shim:
jquery:
exports:
"jquery"
bootstrap:
depts:["jquery"]
angular:
exports:
"angular"
"ui-router":
exports:
"ui.router"
deps : ['angular']
blockui :
deps : ["jquery"]
"angular-resource":
deps: ['angular']
deps :['app','utils/common']
require ['angular','jquery','bootstrap','routes'] ,(angular,$) ->
$(document).ready ->
angular.bootstrap document,['app']
现在我的 app.coffee 是
define ['angular','angular-resource','ui-router'] , (angular) ->
angular.module 'app',['ngResource']
控制台在 chrome 中给出错误
Uncaught TypeError: Cannot read property 'router' of undefined
和
TypeError: g is undefined
g = g[part];
在火狐中。为什么我不能使用 ui-router 作为我的模块来将其加载到我的模块中用于 route.coffee ?