/**
 * @dyna-grid/core - Advanced Data Grid / Data Table supporting Javascript / Web Components
 * @version v1.1.0
 * @link 
 * @license 
 */
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var grid_1 = require("../grid");
function initialiseDyGridWithAngular(angular) {
    var angularModule = angular.module("DyGrid", []);
    angularModule.directive("DyGrid", function () {
        return {
            restrict: "A",
            controller: ['$element', '$scope', '$compile', '$attrs', AngularDirectiveController],
            scope: true
        };
    });
}
exports.initialiseDyGridWithAngular = initialiseDyGridWithAngular;
function AngularDirectiveController($element, $scope, $compile, $attrs) {
    var gridOptions;
    var quickFilterOnScope;
    var keyOfGridInScope = $attrs.DyGrid;
    quickFilterOnScope = keyOfGridInScope + '.quickFilterText';
    gridOptions = $scope.$eval(keyOfGridInScope);
    if (!gridOptions) {
        console.warn("WARNING - grid options for DYNA Grid not found. Please ensure the attribute dyna-grid points to a valid object on the scope");
        return;
    }
    var eGridDiv = $element[0];
    var gridParams = {
        $scope: $scope,
        $compile: $compile,
        quickFilterOnScope: quickFilterOnScope
    };
    var grid = new grid_1.Grid(eGridDiv, gridOptions, gridParams);
    $scope.$on("$destroy", function () {
        if (grid) {
            grid.destroy();
        }
        grid = null;
    });
}

//# sourceMappingURL=dyGridNg.js.map
