I'm new to Angular and I'm trying (for training purposes) to write a converter.
What I'm trying to do is like the converter on Google search page result: https://www.google.com/search?q=1km+to+meter
Basically, it's two inputs bound together and doing conversion stuff on change. When you update the meter
input it updates the kilometer
input and the opposite also works.
For now, I've used a filter to do the conversion (because I find it kind of cool for the job). You can find a live example here: http://jsfiddle.net/FMXhJ/1/
As you can see meter to kilometer works great, but I don't see how could I do the opposite way. So it seems like it won't be the solution to tackle the issue.
I wanted your help to know what is the best solution to do it.
Some $watch
on a controller for both input is a good way to go?