Commit ca196a725fbc0bee850494d4309a05b26214cb4e
1 parent
29558aa1
优化
Showing
3 changed files
with
17 additions
and
15 deletions
Show diff stats
build/Divider/Divider.js
1 | -import template from "./Divider.html"; | |
2 | 1 | import style from "antd/lib/divider/style/index.css"; |
3 | -angular.module("esNgAntd").directive("antdDivider", function (esNgAntd) { | |
4 | - return { | |
5 | - controllerAs: "antdDivider", | |
6 | - restrict: "E", | |
7 | - transclude: true, | |
8 | - replace: true, | |
9 | - template: template, | |
10 | - link: function ($scope, $element, $attrs, $controllers, $transclude) { | |
11 | - esNgAntd.createStyle("ant-divider", style); | |
12 | - }, | |
13 | - }; | |
14 | -}); | |
2 | +import template from "./Divider.html"; | |
3 | +angular.module("esNgAntd").directive("antdDivider", ["esNgAntd", function (esNgAntd) { | |
4 | + return { | |
5 | + template: template, | |
6 | + restrict: "E", | |
7 | + replace: true, | |
8 | + transclude: true, | |
9 | + link: function ($scope) { | |
10 | + esNgAntd.createStyle("ant-divider", style); | |
11 | + } | |
12 | + }; | |
13 | +}]); | |
15 | 14 | \ No newline at end of file | ... | ... |
example/divider.html
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | <div ng-app="esNgAntd" ng-controller="mainCtrl"> |
13 | 13 | <div class="container" style="padding: 50px"> |
14 | 14 | <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.</p> |
15 | - <es-divider></es-divider> | |
15 | + <antd-divider></antd-divider> | |
16 | 16 | <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.</p> |
17 | 17 | </div> |
18 | 18 | </div> | ... | ... |
src/Divider/Divider.js
... | ... | @@ -2,11 +2,14 @@ import template from "./Divider.html"; |
2 | 2 | import style from "antd/lib/divider/style/index.css"; |
3 | 3 | |
4 | 4 | class Divider { |
5 | - template = template; | |
6 | 5 | |
7 | 6 | useModules = ["esNgAntd"]; |
8 | 7 | |
9 | 8 | constructor() { |
10 | 9 | esNgAntd.createStyle("ant-divider", style); |
11 | 10 | } |
11 | + | |
12 | + render() { | |
13 | + return template; | |
14 | + } | |
12 | 15 | } |
13 | 16 | \ No newline at end of file | ... | ... |