尝试覆盖默认的ChartJS系列颜色,但收到Angular无法解析ChartJSProvider依赖项的错误。这不包含在chart.js模块中吗?它们不会指示angularjs图表站点上的任何其他依赖项。以下没有特别的顺序。
Error: [$injector:modulerr] Failed to instantiate module webApp due to: [$injector:unpr] Unknown provider: ChartJSProvider http://errors.angularjs.org/1.6.4/$injector/unpr?p0=ChartJSProvider
var app = angular.module('webApp', ['ngRoute', 'ngMaterial', 'ui.bootstrap', 'md-steppers', 'ngMessages', 'remoteValidation', 'chart.js', 'ngTable']);
app.config(['ChartJSProvider', function(ChartJSProvider){
ChartJSProvider.setOptions({global: {colors:["#2ecc71", "#3498db", "#f1c40f", "#e74c3c"]}});
}]);
<script type="text/javascript" src="{{ url_for('static', filename='js/shared/angular.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/shared/angular-messages.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/shared/md-steppers.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/shared/webapp.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/shared/ngRoute.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/shared/ui-bootstrap.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/shared/ngRemoteValidate.min.js') }}"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='css/shared/oneg.min.css') }}"/>
<link rel="stylesheet" href="{{ url_for('static', filename='css/shared/style.css') }}"/>
<link rel="stylesheet" href="{{ url_for('static', filename='css/md-steppers.min.css') }}"/>
<link rel="stylesheet"; href="https://unpkg.com/ng-table@2.0.2/bundles/ng-table.min.css">
<script src="https://unpkg.com/ng-table@2.0.2/bundles/ng-table.min.js"></script>
<!-- Above are bootstrap imports, below are custom imports -->
<script type="text/javascript" src="{{ url_for('static', filename='js/control_panel.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/deployment_status.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/new_deployment.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/deployment_tasks.js') }}"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='css/custom.css') }}"/>
<!-- Angular Materials v.1.1.0 (and dependencies) -->
<link rel="stylesheet" href="{{ url_for('static', filename='css/angular-material.min.css') }}"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script type="text/javascript" src="{{ url_for('static', filename='js/shared/material/angular-animate.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/shared/material/angular-aria.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/shared/material/angular-material.min.js') }}"></script>
<!-- Angular-Chart.js v.1.1.1 and Chart.js v.2.6.0 -->
<script type="text/javascript" src="{{ url_for('static', filename='js/shared/Chart.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/shared/angular-chart.min.js') }}"></script>