Angular ng-model – Empty input returns null

By Sagie

I have this input:

<input ng-model="data.value" type="number" placeholder="0" value="0">

When I changed the input (for example to 1) and then delete it the data.value
holds null. I want that when I delete the input data.value will hold 0 as a default value.

I saw this solution:
Angular ng-model: empty strings should be null

This is solution will work for me but I want to know if there any other solution without $watch function.

Thanks in advance!

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273