AngularJS,不能添加模块
AngularJS, cannot add modules
所以我对AngularJS
很陌生,我似乎无法添加额外的模块,例如d3
用于图形。
所以我添加新模块的代码是
(function() {
'use strict';
angular
.module('infographicsModule', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSanitize', 'ngMessages', 'ngAria', 'ngResource', 'ui.router', 'ui.bootstrap', 'toastr']);
})();
但是如果我尝试将d3
添加为附加模块,则会引发错误
Uncaught Error: [$injector:modulerr] Failed to instantiate module infographicsModule due to:
Error: [$injector:modulerr] Failed to instantiate module d3 due to:
Error: [$injector:nomod] Module 'd3' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
有什么建议吗?如果你需要更多的代码,我可以发布它。
也许发生这种情况是因为 D3 不是一个角度模块。
您可以尝试使用以下链接执行此操作:https://github.com/WealthBar/angular-d3
或者,您可以封装在服务或工厂中并从中调用。
相关文章:
- 使用System.JS添加模块
- 如何为JS模块添加包含路径
- 将节点模块添加到gitignore
- 如何在RT上添加插件和使用一些外部模块/文件
- Mozilla”;添加“;sdk,简单的pref模块,动态选项(取决于以前选项的选项)
- 添加角光栅时模块实例化失败
- 如何将样式表和jQuery添加到Joomla 3.x模块
- 如何将JavaScript模块添加到生成器meanjs应用程序中
- 错误: [$injector:nomod] 尝试将第三方模块添加到表示应用程序时
- 是否有充分的理由为所有 JavaScript 模块添加前缀“$”
- 动态地将模块添加到我的Angular应用程序中
- 如何向nodejs超级测试模块添加方法
- 我可以向另一个模块中用作依赖项的requirejs模块添加一个方法,并在每次将该模块作为依赖项加载时使其可用吗
- 在同一页面上向Joomla模块添加多个Javascript声明
- 将JavaScript模块添加到全局范围的跨平台方式是什么
- 如何从节点模块添加新的css文件
- Angular:在run()函数中为模块添加工厂方法
- 如何在Node中将函数作为模块添加到现有对象中
- jquery globalize:如何将我需要的模块添加到项目中
- 如何将模块添加到我的SystemJs配置文件中,以便我可以以angular方式导入它