我正在使用有角度的烧瓶。我不知道为什么这不起作用。我想烧瓶路线。
这很有效。我得到了我的图表
localhost:5000/flotcandle
这不起作用。我得到一个空白页但是我看到了html源代码
localhost:5000/ssl/flotcandle
在烧瓶中我改变的是这个
@app.route('/flotcandle')
def flotcandle():
return make_response(open('/home/ubuntu/workspace/forex-api/app/templates/flotcandle.html').read())
添加/ ssl的打击
@app.route('/ssl/flotcandle')
def flotcandle():
return make_response(open('/home/ubuntu/workspace/forex-api/app/templates/flotcandle.html').read())
这是我的角度代码。我不明白为什么会改变这里
var App = angular.module('App', []);
"use strict";
App.controller('Ctrl', function ($scope,$http) {
var data = {"observed": [[0, 1.67122], [1, 1.67121], [2, 1.67153], [3, 1.67153], [4, 1.67043], [5, 1.6713], [6, 1.67043], [7, 1.67043], [8, 1.66995], [9, 1.66991], [10, 1.67011], [11, 1.67011], [12, 1.66995], [13, 1.66998], [14, 1.66998], [15, 1.67023], [16, 1.67003], [17, 1.67023], [18, 1.67023], [19, 1.67037]], "date": [[0, "2014-04-14 08:05:00"], [1, "2014-04-14 08:10:00"], [2, "2014-04-14 08:10:00"], [3, "2014-04-14 08:15:00"], [4, "2014-04-14 08:15:00"], [5, "2014-04-14 08:20:00"], [6, "2014-04-14 08:20:00"], [7, "2014-04-14 08:25:00"], [8, "2014-04-14 08:30:00"], [9, "2014-04-14 08:30:00"], [10, "2014-04-14 08:30:00"], [11, "2014-04-14 08:35:00"], [12, "2014-04-14 08:40:00"], [13, "2014-04-14 08:40:00"], [14, "2014-04-14 08:45:00"], [15, "2014-04-14 08:45:00"], [16, "2014-04-14 08:50:00"], [17, "2014-04-14 08:50:00"], [18, "2014-04-14 08:55:00"], [19, "2014-04-14 09:00:00"]], "forecast": [[0, 1.67052], [1, 1.67123], [2, 1.67123], [3, 1.67093], [4, 1.67093], [5, 1.67149], [6, 1.67149], [7, 1.67135], [8, 1.6715], [9, 1.6715], [10, 1.6715], [11, 1.66981], [12, 1.67011], [13, 1.67011], [14, 1.67007], [15, 1.67007], [16, 1.66988], [17, 1.66988], [18, 1.67009], [19, 1.67026]]};
var data1 = data.observed;
var data2 = data.forecast;
var data = [{data:data1,label: 'observed'},
{data:data2,label: 'forecast',lines:{show:true},points:{show:true}}
];
$scope.data = data;
});
App.directive('chart', function() {
return {
restrict: 'E',
scope: {data: '='},
link: function(scope, elem, attrs) {
scope.$watch('data', function() {
if (scope.data.length > 0) {
var options = {
legend: { show: true},
lines:{show:true},
points:{show:true},
grid: {backgroundColor: '#ffffff'}
};
$.plot(elem, scope.data, options);
elem.show();
}
});
}
};//End return
});//End App
这是我的HTML ..,再次......不知道为什么会有任何改变:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="static/js/jquery/jquery-2.1.0.js"></script>
<script type="text/javascript" src="static/js/flot/jquery.flot.js"></script>
<script type="text/javascript" src="static/js/angular/angular.min.js"></script>
<script type="text/javascript" src="static/lib/flot/controller.js"></script>
<style type='text/css'>
chart {
display:none;
width:800px;
height:400px;
}
</style>
</head>
<body>
<div ng-app='App'>
<div ng-controller='Ctrl'>
<chart data='data'></chart>
</div>
</div>
</body>
</html>
所以..我所做的就是将@app.route('/flotcandle')
更改为@app.route('/ssl/flotcandle')