@@ -30,7 +30,7 @@ <h2>Plain directive</h2>
30
30
</ div >
31
31
</ div >
32
32
33
- < h2 > Use loading < code > <ng-template> </ code > </ h2 >
33
+ < h2 > Use loading < code > <ng-template #loading > </ code > </ h2 >
34
34
< div class ="content ">
35
35
< div class ="implementation " *ngIf ="!example2 ">
36
36
< button mat-flat-button color ="accent " (click) ="example2 = true ">
@@ -39,13 +39,11 @@ <h2>Use loading <code><ng-template></code></h2>
39
39
</ button >
40
40
</ div >
41
41
< div class ="implementation " *ngIf ="example2 ">
42
- < ng-template #error > Loading failed...</ ng-template >
43
42
< ng-template #loading > Loading...</ ng-template >
44
43
< mwc-button
45
44
*axLazyElement ="
46
45
'https://unpkg.com/@material/mwc-button@0.6.0/mwc-button.js?module';
47
46
loadingTemplate: loading;
48
- errorTemplate: error;
49
47
module: true
50
48
"
51
49
raised
@@ -61,10 +59,46 @@ <h2>Use loading <code><ng-template></code></h2>
61
59
< code > <mwc-button> </ code > using the
62
60
< code > *axLazyElement</ code > directive but we're also adding
63
61
< code > <ng-template #loading> Loading...<ng-template> </ code > which
64
- will display before the element was loaded (depending on your connection
65
- speed)
62
+ will be displayed before the element was loaded (depending on your
63
+ connection speed)
66
64
</ p >
67
65
< pre [highlight] ="codeExample2 "> </ pre >
68
66
</ div >
69
67
</ div >
68
+
69
+ < h2 > Use error < code > <ng-template #error> </ code > </ h2 >
70
+ < div class ="content ">
71
+ < div class ="implementation " *ngIf ="!example3 ">
72
+ < button mat-flat-button color ="accent " (click) ="example3 = true ">
73
+ < mat-icon > play_arrow</ mat-icon >
74
+ Run
75
+ </ button >
76
+ </ div >
77
+ < div class ="implementation " *ngIf ="example3 ">
78
+ < ng-template #loading > Loading...</ ng-template >
79
+ < ng-template #error > Loading failed...</ ng-template >
80
+ < mwc-button
81
+ *axLazyElement ="
82
+ 'https://unpkg.com/wrong-url.js?module';
83
+ loadingTemplate: loading;
84
+ errorTemplate: error;
85
+ module: true
86
+ "
87
+ raised
88
+ >
89
+ Submit
90
+ </ mwc-button >
91
+ </ div >
92
+ < div class ="description ">
93
+ < p >
94
+ In this example we're loading
95
+ < code > <mwc-button> </ code > using the
96
+ < code > *axLazyElement</ code > directive but we're also adding
97
+ < code > <ng-template #error> Loading failed...<ng-template> </ code >
98
+ which will be displayed because the loading request will fail (wrong
99
+ url)
100
+ </ p >
101
+ < pre [highlight] ="codeExample3 "> </ pre >
102
+ </ div >
103
+ </ div >
70
104
</ div >
0 commit comments