Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
505
Use angular factory data as dataSource for igGrid
posted

Hello,

I'm working with your igniteui-angular project and am having trouble with the angular controller style igGrid. Mainly is that the call to getData() function in my factory is asynchronous and so the grid is trying to initialize before the dataSource exists.

Here's what the getData() function looks like in my factory

schedulingApp.factory('shiftsFactory', function ($http, $q) {

        var baseUrl = 'odata/ShopShifts';
        var shiftsFactory = {};

        shiftsFactory.getShifts = function (fabLocID) {
            var url = baseUrl + '?$filter=LocID eq \'' + fabLocID + '\'';
            return $http.get(url);
        }

        ...

        return shiftsFactory;

    });

I've found a crappy solution around this, but it comes back to haunt me when trying to add/update the dataSource. Is there maybe an example that exists of the proper way to do the angular controller style igGrid initialization when using an angular factory to get data?

Thanks,

Julie