【发布时间】:2016-12-06 01:44:11
【问题描述】:
我想在我的应用程序中使用“angular-dimple”库,但依赖注入不起作用。在homepage of the library 中,他们说我只需要 html 中包含的 d3 和凹坑链接,并且只需在我的模块声明中包含“angular-dimple”作为依赖项。问题是这不起作用,因为我收到了这个错误:
"...Module 'angular-dimple' 不可用!您拼错了模块名称或忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数。"
我的angular模块声明和html头如下:
var smsApp = angular.module('smsApp', ['angular-dimple', 'ui.bootstrap']);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Solidarity Message Service</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Custom CSS -->
<link rel="stylesheet" type="text/css" href="css/sms-blaster.css">
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://code.jquery.com/jquery.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<script src="angular-1.5.8/angular.js"></script>
<script src="angular-1.5.8/angular-animate.js"></script>
<script src="angular-plugins/ui-bootstrap-tpls-2.2.0.js"></script>
<!-- Dimple graphics dependencies-->
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://dimplejs.org/dist/dimple.v2.1.6.min.js"></script>
<script src="javascripts/sms-blaster.js"></script>
</head>
我在这里错过了什么??
P.S.:我已经尝试将 d3 和dimple 脚本链接放在 html 中的 angular 之前,并且我已经交换了在 angular.module 的依赖数组中引用 angular-dimple 和 ui-bootstrap 的优先级。
【问题讨论】:
-
您错过了在 html 文件中注入 angular-dimple.js 文件。 Here is the documentation for using angular-dimple library 在 d3.js 和 dimple.js 上工作,在本文档中,给出了使用此库的以下步骤