I create a page using the jinja2 template engine and give it as follows:
from flask import render_template @app.route('/', methods=['GET']) def index(): return render_template('index.html')
angular and my js code is connected as follows:
<!DOCTYPE html> <html ng-app='drqApp'> <head lang="en"> <meta charset="UTF-8"> <title></title> </head> <body> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"> </script> <script src="static/js/app.js"></script> ... ... </body>
But the angular application in this case does not work, the page is rendered but angular does not work. If you give index.html
as a file, see the code below, then angular works as it should.
@app.route('/', methods=['GET']) def index(): return send_file('index.html')
What am I doing wrong? Is it possible to connect angular to dynamic pages formed from templates?