@@ -19,31 +19,39 @@ <h2>Dynamic element tag</h2>
19
19
</ div >
20
20
< div class ="implementation " *ngIf ="example1 ">
21
21
< ng-template #loading > Loading...</ ng-template >
22
- < div
22
+ < ax-lazy-element
23
23
*axLazyElementDynamic ="
24
24
'mwc-button';
25
25
url: 'https://unpkg.com/@material/mwc-button@0.6.0/mwc-button.js?module';
26
26
loadingTemplate: loading;
27
27
module: true
28
28
"
29
- outlined
29
+ [ outlined] =" true "
30
30
(click) ="increment1() "
31
31
>
32
32
Increment
33
- </ div >
33
+ </ ax-lazy-element >
34
34
< p > Counter: {{ counter1 }}</ p >
35
35
</ div >
36
36
< div class ="description ">
37
37
< p >
38
38
In this example we're loading
39
39
< code > <mwc-button> </ code > using the
40
40
< code > *axLazyElementDynamic</ code > directive. Please notice that the
41
- original HTML element used in the template is < code > <div> </ code > and
42
- we're specifying the desired tag as the first parameter of
41
+ original HTML element used in the template is
42
+ < code > <ax-lazy-element> </ code > and we're specifying the desired tag
43
+ as the first parameter of
43
44
< code > *axLazyElementDynamic='mwc-button'</ code > . Please, feel free to
44
45
open your browsers dev tools to check resulting element tag!
45
46
</ p >
46
47
< pre [highlight] ="codeExample1 "> </ pre >
48
+ < p >
49
+ You might be asking why do we use < code > <ax-lazy-element> </ code > .
50
+ This is not a real custom element and that's exactly the point. We can
51
+ provide any valid and unused custom element name. That way Angular won't
52
+ complain if we use custom property and event binding which would be the
53
+ case if we tried to bind < code > <div [custom]="value"> </ code > ...
54
+ </ p >
47
55
</ div >
48
56
</ div >
49
57
@@ -57,12 +65,12 @@ <h2>Dynamic element tag with module configuration</h2>
57
65
</ div >
58
66
< div class ="implementation " *ngIf ="example2 ">
59
67
< ng-template #loading > Loading...</ ng-template >
60
- < div
68
+ < ax-lazy-element
61
69
*axLazyElementDynamic ="'wired-button'; loadingTemplate: loading "
62
70
(click) ="increment2() "
63
71
>
64
72
Increment
65
- </ div >
73
+ </ ax-lazy-element >
66
74
< p > Counter: {{ counter2 }}</ p >
67
75
</ div >
68
76
< div class ="description ">
0 commit comments