似乎您既需要 提供文件路径 又需要 注入依赖项。我认为你指的angular-nvd3
是nvd3
angular-nvd3
是包装原始nvd3
图表库的角度模块。它具有角度指令,可帮助您nvd3
在角度应用程序中使用图表(带有绑定等)。
例如(在线查看):
<nvd3 options="options" data="data" class="with-3d-shadow with-transitions"></nvd3>
在angular中必须使用“依赖注入”的原因是因为angular与第三方模块集成的方式:当您要使用第三方angular模块时,需要在应用程序模块定义中将其声明为依赖项。
例如,此语法意味着您声明一个名为的angular应用程序myApp
,它具有对以下内容的依赖关系angular-nvd3
:
angular.module('myApp', ['nvd3'])
.controller(...)
.service(...)
除此之外,您还需要在主html文件中包含第3方库代码,例如:
<meta charset="utf-8"> <!-- it's important for d3.js -->
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/d3/d3.js"></script>
<script src="bower_components/nvd3/nv.d3.js"></script> <!-- or use another assembly -->
<script src="bower_components/angular-nvd3/dist/angular-nvd3.js"></script>
<link rel="stylesheet" href="bower_components/nvd3/nv.d3.css">
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句