I followed the below tutorial and created a successful html page to display a table. However I want to integrate the html file with my Python Flask application to render the html with table data. I tried the below code but it is not working.
http://embed.plnkr.co/w39Xt74pippDajyqUIOD/preview
<script>
angular.module('myApp', ['trNgGrid'])
.controller("MainCtrl", ["$scope", function ($scope) {
$scope.myItems = [
{% for data in datas %}
{
{% for key, value in data.items() %}
{% if value is string %}
'{{ key }}': '{{ value }}',
{% else %}
'{{ key }}': {{ value }},
{% endif %}
{% endfor %}
},
{% endfor %}
];
}]);
</script>
routes.py
@app.route('/page')
def jumping():
df = pd.read_csv(REPORT_CSV)
arr = [row for row in df.to_dict(orient='records')]
return render_template('page.html', datas=arr)
I tried a lot but stuck here. Desparately need some solution. Thanks in advance.