UNPKG
lastinngfor
Version:
latest (1.0.0)
1.0.0
get trigget when last element of ng for loop
lastinngfor
/
last.directive.ts
12 lines
(11 loc)
•
360 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
import
{
Directive
,
ElementRef
,
Input
,
Output
,
EventEmitter
}
from
'@angular/core'
;
@Directive
({
selector
:
'[isLast]'
})
export
class
LastDirective
{
@Input
()
isLast
:
boolean
;
@Output
()
lastDone
:
EventEmitter
<
boolean
> =
new
EventEmitter
<
boolean
>();
ngOnInit
(
) {
if
(
this
.
isLast
) {
this
.
lastDone
.
emit
(
true
); } } }