我正在使用Angular和Flask构建应用程序。我无法在控制台中打印myController
,但我可以打印myApp
。如果我只打开index.html
文件,则相同的代码可用。
var myApp = angular.module('myApp',[]);
myApp.controller('myController',['$scope',function($scope){
$scope.greeting = 'Hello';
$scope.arr = ['a','b','c','d'];
}]);`
<html ng-app="myApp">
<head>
<title>This is experiment title</title>
<h5>This is an experiment.</h5>
</head>
<body ng-controller="myController">
<div>
<span>This is an experiment, and I'm expecting the data : --greeting--!!</span>
<br>----------------
<span ng-repeat='letter in arr'>--This is :{{letter}}--<br></span>
</div>
</body>
</html>
<script src="{{url_for('static', filename='angular.js')}}"></script>
<script src="{{url_for('static', filename='app/app.js')}}"></script>
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def hello_world():
return render_template('index.html')
if __name__ == '__main__':
app.run()