I tried a simple example of angular locally
var app = angular.module("myapp",[]);
app.controller("myctrl", function($scope){
$scope.uplu = function(){
$scope.su = $scope.lu;
};
});
angular.bootstrap(document, ["myapp]);
This is angular code
<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>
There is no problem with this locally and it can be run. However, it fails when running angular on the server (the server only renders the page)
The backend uses flask and simply renders the page, and the above modules can be loaded without error. Has anyone encountered such a problem?
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