I see that in the approach from the question functionality is implemented directly in the component where the is and just for the record I want to share a more elegant approach - creating a component for the purpose
Check the demo plunkr HERE, can be useful for others.