我是angularjs的新手,我在main.js中注入了d3,如下所示:
function (angular) {
'use strict';
angular.module('main', ['ngFileUpload', 'ngCookies', 'ui.router', 'd3'])
.constant('_', window._);
})(window.angular);
但是我收到了错误:
Uncaught Error: [$injector:modulerr]
Failed to instantiate module main 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.
答案 0 :(得分:2)
如果您使用的是普通的d3库,则不会注入角度依赖项。
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" charset="utf-8"></script>
你可以使用d3.js angular指令或d3“wrappers”角度指令,我建议你: