0
votes

I configured Angularjs ui-grid options, to be specific, columnDefs, from Java but because the grid loads before it gets the columnDefs configuration from Java, filtering doesn't show because it loads before and doesn't see any columns.

I used the $http.get('url') function(gridOps) to get the columnDefs.

How could I load config data from Java before ui-grid loads?

Thank you!

1

1 Answers

0
votes

Found the solution:

var app = angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.selection', 'ui.grid.exporter', 'ui.grid.importer', 'ui.grid.autoResize']);

    fetchData().then(bootstrapApplication);
    }
    function fetchData() {
        var initInjector = angular.injector(["ng"]);
        var $http = initInjector.get("$http");

        return $http.get("url").then(function(response) {
            app.constant("config", response.data);

        }, function(errorResponse) {
            // Handle error case
        });
    }
app.controller('MainCtrl', ['$scope','uiGridConstants', '$http','config', function ($scope, uiGridConstants, $http, config) {