0

I have a variable that return with flask "result" and I want use this variable in my app.js that use GridUI. How can I do this?

Here my flask:

def result():
    question = ""
    if request.method == 'POST':
        result = request.form
        question=str(result["question"])

    return render_template("index.html", outforAng= question)

Here my angular code: I want use outforAng, but not works.

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

app.controller('MainCtrl', ['$scope', '$http', function ($scope, $http) {
  $scope.gridOptions1 = {
    paginationPageSizes: [25, 50, 75],
    paginationPageSize: 25,
    columnDefs: [
      { name: 'OBJECT_FAMILY'
      { name: 'PRODUCT_FAMILY' }
    ]
  };

  console.log($scope.outforAng)
  console.log({{outforAng}})
  $http.get('http://127.0.0.1:5000/servedatajson')
  .success(function (data) {

    console.log(data)
    $scope.gridOptions1.data = data;
  });
}]);

Any idea?

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

0 Answers0