我是新來angularjs,我注入D3在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.
是D3是您的角度指令?或只是lib js文件? –
只需添加lib添加到您的索引D3是沒有棱角的指令或模塊可以不加這種方式,但如果你有JS加了你可以在你的控制器 –