title: How to make angular ui-router's parent state always execute controller code when state changes?
body: <p>Let's say we have a parent-child relationship defined in our $stateProvider as follows:</p>
  
  <pre><code>    .state('myProfile', {
          url: "/my/profile",
          templateUrl: 'my/profile.html',
          controller: 'MyProfileController'
      }).state('myProfile.edit', {
          url: "/edit",
          templateUrl: 'my/profile.edit.html',
          controller: 'EditMyProfileController'
      });
  </code></pre>
  
  <p>The idea here is that the parent <code>myProfile</code> state is non-editable, but the child <code>myProfile.edit</code> state is the actual form to edit the profile. Let's ignore if this is how a profile page should work - I'm just playing around with things and learning.</p>
  
  <p>When a user submits the form, I use the $state object to go back to the parent page:</p>
  
  <pre><code>$scope.save = function() {
      userResource.update($scope.user, function() {
          SessionService.refresh();
  
          $state.go('myProfile'); // also tried with reload: true as well
      });
  }
  </code></pre>
  
  <p>After the user saves the profile data - and it <em>is</em> getting saved properly - the parent's view does not get updated unless I hit F5 and refresh the browser. </p>
  
  <p>One thing I have noticed is that if I make the child <code>myProfile.edit</code> state into a parent itself and not a child of the <code>myProfile</code> state, this problem actually goes away and things behave as expected (albeit, the layout looks bad like this).</p>
  
  <p>It seems that UI Router is maybe caching the result of the parent, unsuspecting that things have changed in the model and that it needs to rerun the controller?</p>
  
  <p>How can I keep my parent-child relationship while still having the parent <code>myProfile</code> page always execute its controller to reload its data? Basically, I want this to happen whenever <code>$state</code> is used or when a link is clicked that directs to <code>myProfile</code>. How can I do that?</p>
  
  <p>And if I cannot do what I ask, then I am aware that I can setup a bunch of child states and have them work as intended... however, how can I set the default child state for the parent? For example, let's say I want <code>myProfile.edit</code> to be the default child state of <code>myProfile</code> - how can I do that?</p>
  
  <p>Thanks!</p>