-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
60 lines (54 loc) · 1.16 KB
/
test.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
$ = window.$ = require("jquery");
require("angular");
angular
.module('App', [])
.controller('MainCtrl', function($scope) {
$scope.what = "World";
})
.directive('outer', function() {
return {
restrict: 'E',
scope: {
some: '@'
},
templateUrl: 'outer.html'
}
})
.directive('embolden', function() {
return {
restrict: 'E',
transclude: true,
scope: { wahteva: '@?' },
templateUrl: 'embolden.html'
}
})
.directive('multiSlot', function() {
return {
transclude: true,
controller: function() {
this.slots = {}
},
link: function(scope, el, attrs, ctrl, transclude) {
transclude(function(clone) {
console.log([el, clone]);
$(el).append(clone);
});
}
}
})
.directive('forSlot', function() {
return {
require: '^^multiSlot',
link: function(scope, el, attrs, ctrl, transclude) {
ctrl.slots[attrs.forSlot].replaceWith(el);
}
}
})
.directive('slot', function() {
return {
require: '^^multiSlot',
link: function(scope, el, attrs, ctrl) {
ctrl.slots[attrs.slot] = el;
}
}
})