forked from pankajparkar/gridstack-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgridstack.controller.js
More file actions
37 lines (28 loc) · 846 Bytes
/
Copy pathgridstack.controller.js
File metadata and controls
37 lines (28 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(function () {
'use strict';
angular.module('gridstack-angular', []);
var app = angular.module('gridstack-angular');
app.controller('GridstackController', ['$scope', function ($scope) {
var self = this;
this.init = function (element, options) {
self.gridstackHandler = element.gridstack(options).data('gridstack');
return self.gridstackHandler;
};
this.removeItem = function (element) {
if (self.gridstackHandler) {
return self.gridstackHandler.removeWidget(element, false);
}
return null;
};
this.addItem = function (element) {
if (self.gridstackHandler) {
self.gridstackHandler.makeWidget(element);
return element;
}
return null;
};
this.$onDestroy = function () {
self.gridstackHandler.destroy();
};
}]);
})();