1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | "use strict";
|
8 | Object.defineProperty(exports, "__esModule", { value: true });
|
9 | var grid_1 = require("../grid");
|
10 | function 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 | }
|
20 | exports.initialiseAgGridWithAngular1 = initialiseAgGridWithAngular1;
|
21 | function 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 | }
|