我在本地试了一下angular的简单例子
var app = angular.module("myapp",[]);
app.controller("myctrl", function($scope){
$scope.uplu = function(){
$scope.su = $scope.lu;
};
});
angular.bootstrap(document, ["myapp]);
这个是 angular代码
<html>
<head>
</head>
<body>
<p ng-controller="myctrl">
<p>请输入 字符</p>
<input type="text" ng-model="lu">
<button ng-click="uplu()">uplu</button>
<p>{{su}}</p>
</p>
<script src="http://cdn.staticfile.org/angular.js/1.3.0-beta.13/angular.min.js"></script>
<script src="myapp.js"></script>
</body>
</html>
这个在本地上是没有什么问题的, 可以运行出来 但是在服务器上运行angular就失效了(服务器也只是把页面渲染出来而已)
后台用的是 flask 只是简单渲染了一下页面,而且上面的模块都能加载的到而且不报错, 有没有人遇到过这样的问题啊。
为情所困2017-05-15 16:52:22
It turns out that there is a conflict between the angular rendering template and the default jinja2 of flask. The solution is to add {% raw %}{% endraw %} to the static file so that jinja2 will not render the content or use {{" {{}}"}}Methods. The main thing is that jinja2 and angularde {{}} placeholders are the same