forked from angular-ui/ui-sortable
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsortable.test-directives.js
More file actions
38 lines (35 loc) · 1.01 KB
/
sortable.test-directives.js
File metadata and controls
38 lines (35 loc) · 1.01 KB
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
'use strict';
angular.module('ui.sortable.testDirectives', [])
.directive('uiSortableSimpleTestDirective',
function() {
return {
restrict: 'AE',
scope: true,
require: '?ngModel',
template: '<div>Directive: <span class="itemContent" ng-bind="text"></span> !!!</div>',
link: function(scope, element, attrs) {
scope.$watch(attrs.ngModel, function(value) {
scope.text = value;
});
}
};
}
)
.directive('uiSortableDestroyableTestDirective',
function() {
return {
restrict: 'AE',
scope: true,
require: '?ngModel',
template: '<div>$destroy(able) Directive: <span class="itemContent" ng-bind="text"></span> !!!</div>',
link: function(scope, element, attrs) {
scope.$watch(attrs.ngModel, function(value) {
scope.text = value;
});
element.bind('$destroy', function() {
element.html('');
});
}
};
}
);