When does "$viewValue" become "NOT undefined"?
<p>Here is my example to count value length in the input text:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>let app = angular.module('myApp', []);
app.controller('myController', function ($scope) {
  $scope.submit = function ($event, form) {
    $event.preventDefault();
    
    alert(form.myinput.$viewValue.length)
  };
});</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"&gt;&lt;/script&gt;
&lt;form id="myForm" ng-model="myForm" name="myForm" novalidate ng-app="myApp" ng-controller="myController"&gt;
  &lt;input ng-model="myinput" name="myinput" /&gt;
  &lt;a href="#" ng-click="submit($event, myForm)"&gt;Submit&lt;/a&gt;
&lt;/form&gt;</code></pre>
</div>
</div>
</p>

<p>The problem: If the value in the input is null or empty (the input contained nothing before), it would throw this error when clicking on <code>submit</code>:</p>

<blockquote>
  <p><strong>TypeError</strong>: Cannot read property 'length' of undefined
      at a.$$childScopeClass.$$childScopeClass.$scope.submit</p>
</blockquote>

<p>Then, I've tried to type something in the input, delete it and click on <code>submit</code> again. It should work.</p>

<p>My question: for <code>input[type=text]</code>, is there nothing like <code>default value</code> with property <code>$viewValue</code>?</p>

<p>I mean: if the value is null or empty, <code>form.myinput.$viewValue</code> should be <code>''</code>. So, the length must be <code>0</code>.</p>