Tag: @input

Intercepting the value change of an @input()

Intercepting the value change of an @input()

I am working on a component that handles pictures upload, for various reasons, the real upload happens externally.
It’s possibile to integrate it in a form or pass to it a callback that is fired after the files are selected.
When I use it within a form, I have another component for showing a progressbar, when I pass to it a callback, I use the embedded progressbar.

The embedded progressbar, needs to know the percentage of the upload, I pass it throught an @input(), when it reaches 100 I want to make the progressbar desappear and get my icon back.

So how to intercept the value?

Well, we have two methods:

1) ngOnChanges

2) set,get