未捕获的ReferenceError:myController未定义在<anonymous>:1:1(匿名)@ VM2169:1

时间:2017-02-10 02:18:42

标签: javascript angularjs flask

我正在使用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()

0 个答案:

没有答案