Angular textbox default value
<p>Sorry for my English</p>

<p>I want to reuse same page for <code>Create</code> / <code>Edit</code> data</p>

<p>But need to initial some default with the field is <code>null</code> / <code>undefined</code></p>

<p>i don't want check the field is null in controller like</p>

<pre><code>scope.user = {};
$scope.user.status = $scope.user.status || "some init value";
</code></pre>

<p>but i tried ng-init with no luck</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-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;

  &lt;head&gt;
    &lt;script data-require="angularjs@1.5.8" data-semver="1.5.8" src="https://opensource.keycdn.com/angularjs/1.5.8/angular.min.js"&gt;&lt;/script&gt;
    &lt;link rel="stylesheet" href="style.css" /&gt;
    &lt;script src="script.js"&gt;&lt;/script&gt;
    
    &lt;script&gt;
      angular
        .module('testDefaultValue', [])
        .controller('testCtrl', ['$scope', function($scope) {
          $scope.newUser = {}; 
          $scope.existingUser = { status: "Locked" };
        }]);
    &lt;/script&gt;
  &lt;/head&gt;

  &lt;body ng-app="testDefaultValue" ng-controller="testCtrl"&gt;
    &lt;label&gt;User Status:&lt;/label&gt;
    &lt;input
      type="text"
      ng-model="newUser.status"
      ng-init="newUser.status = 'Active' "
    /&gt;
    &lt;br /&gt;
    Should be: Active
    &lt;br /&gt;
    &lt;br /&gt;
    
    &lt;label&gt;User Status:&lt;/label&gt;
    &lt;input
      type="text"
      ng-model="existingUser.status"
      ng-init="existingUser.status = 'Active' "
    /&gt;
    &lt;br /&gt;
    Should be: Locked
    &lt;br /&gt;
    
  &lt;/body&gt;
&lt;/html&gt;</code></pre>
</div>
</div>
</p>