0

Hi I am calling in angular.js to a template saved in templates folder in flask but not works, how can I get static files in js from flask?

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",

...

Joan Triay
  • 1,518
  • 6
  • 20
  • 35

1 Answers1

0

I solved adding to my flask the next lines:

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

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

And at my .js file changing:

expandableRowTemplate: "http://127.0.0.1:5000/templates/expandableRowTemplate",
Joan Triay
  • 1,518
  • 6
  • 20
  • 35