我尝试使用angular-bootstrap-nav-tree库,但我无法添加' angularBootstrapNavTree'到我的模块的依赖项列表。有错误
"Unknown provider: angularBootstrapNavTreeProvider <- angularBootstrapNavTree"
angular.
module('myApp').
component('treeList', {
template: ' <abn-tree tree-data="my_data"></abn-tree>',
controller: function MyCtrl($http, $scope, dataContext, angularBootstrapNavTree) {
$scope.my_data = [{
label: 'Languages',
children: ['Jade','Less','Coffeescript'],
classes: ["special", "red"]
}]
});
答案 0 :(得分:0)
您实际上已将其添加到模块的依赖项列表中,而不是添加到控制器的依赖项中。
{{1}}
答案 1 :(得分:0)
你错过了你的合成器中的;
和}
,我修复了它:
angular.
module('myApp').
component('treeList', {
template: '<abn-tree tree-data="my_data"></abn-tree>',
controller: function MyCtrl($http, $scope, dataContext, angularBootstrapNavTree) {
$scope.my_data = [{
label: 'Languages',
children: ['Jade','Less','Coffeescript'],
classes: ["special", "red"]
}];
}
});
此外,您可能忘记将angularBootstrapNavTree
添加到模块依赖项中:
angular.module('myApp', ['angularBootstrapNavTree']);