ddd373d9
Imshann
优化Card组件
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
angular.module("esNgAntd").directive("antdSlot", ["$compile", function ($compile) {
return {
restrict: "E",
replace: true,
transclude: true,
scope: {
content: "@",
context: "="
},
controller: function ($scope, $element) {
$scope.watch = {
content: function (newVal) {
if (newVal !== undefined) {
if (/<[^>]+>/.test(newVal)) {
$element.replaceWith($compile(newVal)($scope.context ? $scope.context : $scope));
} else {
$element.text(newVal);
|
ddd373d9
Imshann
优化Card组件
|
19
20
21
22
23
24
25
26
27
28
29
|
}
}
};
},
link: function ($scope) {
for (const key in $scope.watch) {
$scope.$watch(key, $scope.watch[key], true);
}
}
};
}]);
|