0
我想通過angular
ngRoute
加載圖表(高圖表庫)ngRoute
,但我無法顯示圖表。通過Angular加載圖表ngRoute不工作
JS - 這是我的配置
var app = angular.module('myApp', [
'ngRoute'
]);
app.config(function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'some.html',
controller: 'MainCtrl'
})
.when('/contacts/:_id', {
templateUrl: 'contacts/some.html',
controller: 'SecondCtrl'
})
.otherwise({
redirectTo: '/'
});
});
JS - 這些都是我的控制器
app.controller('MainCtrl', ['$scope', function($scope) {
// some code here
}]);
app.controller('SecondCtrl', ['$scope', function($scope) {
//some code here
// drawing chart function
$(function() {
$('#container').highcharts({
//rest of the code
}]);
HTML //contacts/some.html頁面
在控制檯中沒有錯誤,雖然圖表未加載
加載到主pag e - index.html只有寫入
<div ng-controller="SecondCtrl">
<div id="container"></div>
</div>
你肯定你的div是空的?也許它被填充,但有一些CSS問題?檢查鉻開發工具 –
是的,它是空的,我認爲這個問題是在路由 –
這是CSS問題:)謝謝。圖表只顯示在bootstrap divs後面,現在探索如何解決它。非常感謝 –