admin管理员组文章数量:1389805
Summary of code:
main.js:
require.config({
paths: {
'uiBootstrap': '../lib/bootstrap/angular-bootstrap/ui-bootstrap-tpls.min'
},
shim: {***},
priority: ['angular'],
deps: [
'./bootstrap'
]
});
bootstrap.js:
define([
'require',
'angular',
...
], function (require, ng) {
'use strict';
require([
'domReady!',
'uiBootstrap'
], function (document) {
ng.bootstrap(document, ['app']);...
app.js:
define([
'angular',
...
], function (ng) {
'use strict';
return ng.module('app', [
...
'uiBootstrap'
]);
});
I was getting a range of differing errors while trying different binations. Until I went into ui-bootstrap-tpls.min.js and actually Replaced All ui.bootstrap to uiBootstrap and modifed the module name reference as seen above. And presto - ui-bootstrap is working fine.
Obviously this is a less than optimal solution.
Can anyone please provide insight why this is occurring and what the better approach to resolve it is, so I don't go public using this source modified ui-bootstrap?
Thank You!
Summary of code:
main.js:
require.config({
paths: {
'uiBootstrap': '../lib/bootstrap/angular-bootstrap/ui-bootstrap-tpls.min'
},
shim: {***},
priority: ['angular'],
deps: [
'./bootstrap'
]
});
bootstrap.js:
define([
'require',
'angular',
...
], function (require, ng) {
'use strict';
require([
'domReady!',
'uiBootstrap'
], function (document) {
ng.bootstrap(document, ['app']);...
app.js:
define([
'angular',
...
], function (ng) {
'use strict';
return ng.module('app', [
...
'uiBootstrap'
]);
});
I was getting a range of differing errors while trying different binations. Until I went into ui-bootstrap-tpls.min.js and actually Replaced All ui.bootstrap to uiBootstrap and modifed the module name reference as seen above. And presto - ui-bootstrap is working fine.
Obviously this is a less than optimal solution.
Can anyone please provide insight why this is occurring and what the better approach to resolve it is, so I don't go public using this source modified ui-bootstrap?
Thank You!
Share Improve this question asked Apr 14, 2014 at 19:39 hzanehzane 7371 gold badge8 silver badges9 bronze badges1 Answer
Reset to default 7In your app.js
when giving the dependencies to angular
you should give it as 'ui.bootstrap'
(this is the correct module name) and not your custom name which you defined in main.js
.
So your app.js
would look like:
define([
'angular',
'uiBootstrap',
...
], function (ng) {
'use strict';
return ng.module('app', [
...
'ui.bootstrap'
]);
});
本文标签: javascriptLoading angular uibootstrap with requirejs fails unless i rename uibootstrapStack Overflow
版权声明:本文标题:javascript - Loading angular ui-bootstrap with require.js fails unless i rename ui.bootstrap? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744686459a2619730.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论