In Angular 1.6, when the user removes values inside inputs, these values are set up to "undefined". It seems to be the default behaviour in AngularJS.
HTML
<input ng-model="name" class="form-control" id="inp_name"
placeholder="My Name" required="true" value="" />
Controller
...
$scope.name = ""; <-- here the initial value is correctly set up as empty
...
$scope.submit = function(){
alert($scope.name); <-- the value can be "undefined" if the user removed all the string
};
How to automatically set up the value as empty instead of "undefined" each time the text input is empty on the front-end ?