角度表达式{{}}在flask中不起作用,即使修改了开始和结束插值标记

2024-04-25 09:17:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我是新来的,烧瓶。我正在开发一个简单的web应用程序。我在一个网页上显示了一个从数据库检索到的记录列表,在这个网页上我使用了双开合花括号作为表达式,但它不起作用,因为Flask使用Jinja2引擎呈现模板,Jinja2还使用双花括号{{}}插入值。因此,我使用了link中给出的解决方案。作为单独的表中的数据,我不显示它。你知道吗

我在选项卡标题中得到的错误消息是

"TemplateSyntaxError:Encountered unknown tag 'endfor'. //Werkzeug Debugger"

这是我的角度代码

<script>
angular.module('myapp', [])
.controller('myctrl', ['$scope', function($scope) {
    $scope.myname = "Howdy !!";
}])
.config(function($interpolateProvider) {
    $interpolateProvider.startSymbol('//').endSymbol('//');
});
</script>

这是我的HTML代码

<div ng-app="myapp" ng-controller="myctrl">
        //myname//
        <table>
        <caption> Todo List</caption>
            <thead>
                <tr>
                    <td>
                        <input type="text" id="addText" name="text" ng-model="addMe">
                        <input type="submit"  name="my-form" value="Add Task" >

                    </td><td>
                    Search :<input type="text"> 

                    </td>
                </tr>
                <tr>
                    <th>Task Id</th>
                    <th>Task</th>
                </tr>
            </thead>

            <tbody>

                {% for user in User %}
                <tr ng-repeat= "user in User">
                    <td>
                    //user.uid//

                    </td>
                    <td>//user.taskname//

                        <span style="padding-right:3px; padding-top: 3px; display:inline-block;" ></span>
                        <input type="image" class="deleteImg" src="static/img/trash_can.png" height="15px" width="18px" name="removeId" value={{user.uid}} ></input> 
                         <input type="image"  id='addButton' src="static/img/editbtn.svg" height="15px" width="18px" name="editId" value={{user.uid}} ></input>

                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>

    </div>

Tags: textname网页taskinputuidvaluetype