UNPKG

1.5 kBJavaScriptView Raw
1/**
2 * ag-grid - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
3 * @version v18.1.2
4 * @link http://www.ag-grid.com/
5 * @license MIT
6 */
7"use strict";
8Object.defineProperty(exports, "__esModule", { value: true });
9var grid_1 = require("../grid");
10function initialiseAgGridWithAngular1(angular) {
11 var angularModule = angular.module("agGrid", []);
12 angularModule.directive("agGrid", function () {
13 return {
14 restrict: "A",
15 controller: ['$element', '$scope', '$compile', '$attrs', AngularDirectiveController],
16 scope: true
17 };
18 });
19}
20exports.initialiseAgGridWithAngular1 = initialiseAgGridWithAngular1;
21function AngularDirectiveController($element, $scope, $compile, $attrs) {
22 var gridOptions;
23 var quickFilterOnScope;
24 var keyOfGridInScope = $attrs.agGrid;
25 quickFilterOnScope = keyOfGridInScope + '.quickFilterText';
26 gridOptions = $scope.$eval(keyOfGridInScope);
27 if (!gridOptions) {
28 console.warn("WARNING - grid options for ag-Grid not found. Please ensure the attribute ag-grid points to a valid object on the scope");
29 return;
30 }
31 var eGridDiv = $element[0];
32 var gridParams = {
33 $scope: $scope,
34 $compile: $compile,
35 quickFilterOnScope: quickFilterOnScope
36 };
37 var grid = new grid_1.Grid(eGridDiv, gridOptions, gridParams);
38 $scope.$on("$destroy", function () {
39 grid.destroy();
40 grid = null;
41 });
42}