【问题标题】:how to call static template from angular js with flask? [duplicate]如何使用烧瓶从 Angular js 调用静态模板? [复制]
【发布时间】:2017-02-01 12:53:04
【问题描述】:

您好,我在 angular.js 中调用保存在烧瓶模板文件夹中的模板但不起作用,如何从烧瓶中获取 js 中的静态文件?

var app = angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.expandable', 'ui.grid.selection', 'ui.grid.pinning', 'ui.grid.pagination']);


app.controller('ThirdCtrl', ['$scope', '$http', '$log', function ($scope, $http, $log) {

      $scope.gridOptions = {
      paginationPageSizes: [25, 50, 75],
      paginationPageSize: 25,
      expandableRowTemplate: "/templates/expandableRowTemplate.html",

...

【问题讨论】:

  • 你可以添加你的烧瓶代码,或者更多的代码吗?
  • 解决了@ZombieChowder

标签: javascript python angularjs flask


【解决方案1】:

我解决了将下一行添加到烧瓶中的问题:

def template():
    return render_template("expandableRowTemplate.html")

app.add_url_rule('/templates/expandableRowTemplate', 'template', template)

在我的 .js 文件更改时:

expandableRowTemplate: "http://127.0.0.1:5000/templates/expandableRowTemplate",

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-20
    • 2017-04-13
    • 1970-01-01
    • 2017-12-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-25
    相关资源
    最近更新 更多