Angular、bootstrap-ui 与 requirejs 问题
Angular, bootstrap-ui with requirejs issues
我正在尝试在我的 angualr 项目中使用 bootstrap-ui 和 requirejs。
我想我已经正确设置了它,但是它似乎有一些问题 - 这是我的设置 -
require.config({
paths: {
'angular': '//thirdparty/angular/1.3.4/angular.min',
'underscore': '//thirdparty/underscore/1.6.0/underscore.min',
'bootstrap-ui' : 'https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap.min',
'bootstrap-ui-tpls' : 'https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min',
},
shim: {
'angular': {
exports: 'angular'
},
'underscore': {
exports: '_'
},
'bootstrap-ui-tpls' : {
deps: ['angular'],
exports: 'bootstrap-ui-tpls'
},
'bootstrap-ui': {
deps: ['angular','bootstrap-ui-tpls']
}
}
});
- 我假设您需要像这样添加 tpls - 这可能是问题的一部分?
然后我就在我正在使用它的模块中定义它,就像这样:
define('file.tabs/directive', [
'bootstrap-ui'
], function(bootstrapUi) {
var metaData = {
moduleName: 'FileTabsDirective',
componentName: 'FileTabs'
};
angular.module(metaData.moduleName, [
'ui.bootstrap'
]).directive(metaData.componentName,
所以我尝试在我加载它的模块中使用 tabset 位 - 并得到这个:
load resource: the server responded with a status of 502 (Bad Gateway)
http://localhost:9000/template/tabs/tabset.html
所以它正在寻找 template/tabs/tabset.html - 肯定不存在。可以使用一些帮助,这有点令人困惑。谢谢!
您不需要加载这两个库,只需使用带有模板的版本即可。差异解释 here.
我正在尝试在我的 angualr 项目中使用 bootstrap-ui 和 requirejs。
我想我已经正确设置了它,但是它似乎有一些问题 - 这是我的设置 -
require.config({
paths: {
'angular': '//thirdparty/angular/1.3.4/angular.min',
'underscore': '//thirdparty/underscore/1.6.0/underscore.min',
'bootstrap-ui' : 'https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap.min',
'bootstrap-ui-tpls' : 'https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.1/ui-bootstrap-tpls.min',
},
shim: {
'angular': {
exports: 'angular'
},
'underscore': {
exports: '_'
},
'bootstrap-ui-tpls' : {
deps: ['angular'],
exports: 'bootstrap-ui-tpls'
},
'bootstrap-ui': {
deps: ['angular','bootstrap-ui-tpls']
}
}
});
- 我假设您需要像这样添加 tpls - 这可能是问题的一部分?
然后我就在我正在使用它的模块中定义它,就像这样:
define('file.tabs/directive', [
'bootstrap-ui'
], function(bootstrapUi) {
var metaData = {
moduleName: 'FileTabsDirective',
componentName: 'FileTabs'
};
angular.module(metaData.moduleName, [
'ui.bootstrap'
]).directive(metaData.componentName,
所以我尝试在我加载它的模块中使用 tabset 位 - 并得到这个:
load resource: the server responded with a status of 502 (Bad Gateway)
http://localhost:9000/template/tabs/tabset.html
所以它正在寻找 template/tabs/tabset.html - 肯定不存在。可以使用一些帮助,这有点令人困惑。谢谢!
您不需要加载这两个库,只需使用带有模板的版本即可。差异解释 here.