Can I in angular4 do something like this in a template?:
<input (input)="number= $event.target.value; ChangeValues()" id="number" type="number">
if it is possible to do it, where should the function be declared ChangeValues()
in my component?
I've seen your answer and it's not really done that way (although it works).
I'll give you a simple example:
Ver ejemplo online
What we do in the event
(input)
is assign the methodchangeValues($event)
and pass the event object as a parameter.Then in the component you can manipulate the values, as needed.
I don't know if it is the best way. But I have achieved it by adding a function to a component object.