title: Angular won't apply object changes to it's properties
body: <p>I have an object like this:</p>
  
  <pre><code>$scope.user = {key: 'j16er48', name: 'Foo', title: 'Bar'}
  </code></pre>
  
  <p>And the template is:</p>
  
  <pre><code>&lt;div ng-if="user.key"&gt;{{user.name}}&lt;/div&gt;
  </code></pre>
  
  <p>Now, if I change the value of <code>key</code> property to <code>null</code> or <code>false</code> directly, then the <code>div</code> won't be displayed. But If I change the whole object to this:</p>
  
  <pre><code>$scope.user = {key: false, name: 'Foo', title: 'Bar'}
  </code></pre>
  
  <p>Nothing happens. Angular seems to still watch the old object and the old value of <code>key</code> property.</p>
  
  <p>I also tried to use <code>$scope.$apply()</code> after assigning a new object to <code>user</code> but still no chance.</p>
  
  <p>Am I missing something?</p>
  
  <p>== <strong>UPDATE</strong> ==</p>
  
  <p>After so much tests I found a very strange behavior in Angular scope. The issue happens due to an unwanted assignment by reference (or a two-way binding maybe).</p>
  
  <p>I have an object called <code>defaultUser</code> which is : <code>{key: false, name: 'Foo', title: 'Bar'}</code>. Assuming this:</p>
  
  <pre><code>var defaultUser = {key: false, name: null, title: null};
  
  $scope.user = defaultUser;
  
  // here I change a property of $scope.user
  $scope.user.key = 'j16er48';
  
  $scope.resetUser = function(){
      // Now defaultUser.key equals 'j16er48'
      alert(defaultUser.key);
  
      // That's why this line does nothing
      $scope.user = defaultUser;
  }
  </code></pre>
  
  <p>So when I tried to assign <code>defaultUser</code> to <code>user</code> object again, I thought is has been reset, whereas <code>defaultUser</code> has been changed and is equal to <code>user</code>. right now.</p>
  
  <p>Is that normal? Does Angular assume all assignments by reference? Is that a two-way binding? Have I been crazy or what else?</p>
  
  <p><a href="https://jsfiddle.net/amraei/g1b5xomz/3/" rel="nofollow">https://jsfiddle.net/amraei/g1b5xomz/3/</a></p>