Angularjs 如何注入d3依赖关系?
我是angularjs新手,我在main.js中注入d3如下:Angularjs 如何注入d3依赖关系?,angularjs,d3.js,Angularjs,D3.js,我是angularjs新手,我在main.js中注入d3如下: function (angular) { 'use strict'; angular.module('main', ['ngFileUpload', 'ngCookies', 'ui.router', 'd3']) .constant('_', window._); })(window.angular); 但我有一个错误: Unca
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.
如果您使用的是普通d3库,则不会注入角度依赖项
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" charset="utf-8"></script>
您可以使用d3.js角度指令或d3“wrappers”角度指令,我建议您: