title: ion-view title does not show when using ng-if
body: <p>I am doing an intro screen for an app. This screen (3 slides) only appears when on new user. So the way I do it is:</p>
  
  <ol>
  <li><p>Default route is always going to this intro screen</p></li>
  <li><p>From the intro screen controller, check (cookie) to see if the user has seen this screen before. The depending on that, toggle <code>$scope.showIntro</code>. Then do <code>$state.go()</code> to next main app screen.</p></li>
  <li><p>In the intro view, use <code>ng-if="showIntro"</code>. So if $scope.showIntro == false, the DOM is blank.</p></li>
  </ol>
  
  <p>Here are the tricky parts: </p>
  
  <ol>
  <li><p>There is no way to check for whether the user has seen this screen or not because I am using <code>$localStorage</code> and it doesn't exist in app() when I create the route. That's why I have to do this check logic in the controller.</p></li>
  <li><p>I had to use <code>ng-if</code> because if I use <code>ng-show</code>, it's too slow and the user will see a flash of intro screens before being routed to main screen.</p></li>
  </ol>
  
  <p><strong>THE PROBLEM:</strong></p>
  
  <p>If I use <code>ng-if</code> on <code>ion-view</code> component, the title does not get <strong>refreshed</strong> once the DOM is injected into the view again. <strong>Why is that and how to fix this problem? Maybe some way to re-run digest?</strong></p>
  
  <p><strong>Code</strong> <a href="http://codepen.io/hawkphil/pen/jPLqge" rel="nofollow noreferrer">http://codepen.io/hawkphil/pen/jPLqge</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>angular.module('ionicApp', ['ionic'])
      
  .config(function($stateProvider, $urlRouterProvider) {
      
  $stateProvider
        .state('intro', {
          url: '/',
          templateUrl: 'templates/intro.html',
          controller: 'IntroCtrl'
        })
        .state('main', {
          url: '/main',
          templateUrl: 'templates/main.html',
          controller: 'MainCtrl'
        });
      
        $urlRouterProvider.otherwise("/");
      
      })
      
      .controller('IntroCtrl', function($scope, $state, $ionicSlideBoxDelegate) {
        $scope.title = "&lt;b&gt;CUSTOM&lt;/b&gt; TITLE";
        $scope.showIntro = true;
        
        // Called to navigate to the main app
        $scope.startApp = function() {
          $state.go('main');
        };
        $scope.next = function() {
          $ionicSlideBoxDelegate.next();
        };
        $scope.previous = function() {
          $ionicSlideBoxDelegate.previous();
        };
      
        // Called each time the slide changes
        $scope.slideChanged = function(index) {
          $scope.slideIndex = index;
        };
      })
      
      .controller('MainCtrl', function($scope, $state) {
        console.log('MainCtrl');
        
        $scope.toIntro = function(){
          $state.go('intro');
        }
      });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>    body {
        cursor: url('http://ionicframework.com/img/finger.png'), auto;
      }
      .slider {
        height: 100%;
      }
      .slider-slide {
        padding-top: 80px;
        color: #000;
        background-color: #fff;
        text-align: center;
      
        font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 
        font-weight: 300;
      }
      
      #logo {
        margin: 30px 0px;
      }
      
      #list {
        width: 170px;
        margin: 30px auto;
        font-size: 20px;
      }
      #list ol {
        margin-top: 30px;
      }
      #list ol li {
        text-align: left;
        list-style: decimal;
        margin: 10px 0px;
      }
      
      .button.ng-hide{
        display:none;
      }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;html&gt;
        &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"&gt;
          &lt;title&gt;Ionic App&lt;/title&gt;
      
          &lt;link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet"&gt;
          &lt;script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"&gt;&lt;/script&gt;
        &lt;/head&gt;
      
        &lt;body ng-app="ionicApp"&gt;
      
          &lt;ion-nav-bar class="bar-light"&gt;
              &lt;ion-nav-back-button&gt;
              &lt;/ion-nav-back-button&gt;
          &lt;/ion-nav-bar&gt;
      
          &lt;ion-nav-view&gt;&lt;/ion-nav-view&gt;
      
      
          &lt;script id="templates/intro.html" type="text/ng-template"&gt; 
            &lt;ion-view view-title="{{ title }}" ng-if="showIntro"&gt;
              &lt;ion-nav-buttons side="left"&gt;
                &lt;button class="button button-positive button-clear no-animation"
                        ng-click="startApp()" ng-show="!slideIndex"&gt;
                  Skip Intro
                &lt;/button&gt;
                &lt;button class="button button-positive button-clear no-animation"
                        ng-click="previous()" ng-show="slideIndex &gt; 0"&gt;
                  Previous Slide
                &lt;/button&gt;
              &lt;/ion-nav-buttons&gt;
              &lt;ion-nav-buttons side="right"&gt; 
                &lt;button class="button button-positive button-clear no-animation"
                        ng-click="next()" ng-show="slideIndex != 2"&gt;
                  Next
                &lt;/button&gt;
                &lt;button class="button button-positive button-clear no-animation"
                        ng-click="startApp()" ng-show="slideIndex == 2"&gt;
                  Start using MyApp
                &lt;/button&gt;
              &lt;/ion-nav-buttons&gt;
              &lt;ion-slide-box on-slide-changed="slideChanged(index)"&gt;
                &lt;ion-slide&gt;
                  &lt;h3&gt;Thank you for choosing the Awesome App!&lt;/h3&gt;
                  &lt;div id="logo"&gt;
                    &lt;img src="http://code.ionicframework.com/assets/img/app_icon.png"&gt;
                  &lt;/div&gt;
                  &lt;p&gt;
                    We've worked super hard to make you happy.
                  &lt;/p&gt;
                  &lt;p&gt;
                    But if you are angry, too bad.
                  &lt;/p&gt;
                &lt;/ion-slide&gt;
                &lt;ion-slide&gt;
                  &lt;h3&gt;Using Awesome&lt;/h3&gt;
                  
                  &lt;div id="list"&gt;
                    &lt;h5&gt;Just three steps:&lt;/h5&gt;
                    &lt;ol&gt;
                      &lt;li&gt;Be awesome&lt;/li&gt;
                      &lt;li&gt;Stay awesome&lt;/li&gt;
                      &lt;li&gt;There is no step 3&lt;/li&gt;
                    &lt;/ol&gt;
                  &lt;/div&gt;
                &lt;/ion-slide&gt;
                &lt;ion-slide&gt;
                  &lt;h3&gt;Any questions?&lt;/h3&gt;
                  &lt;p&gt;
                    Too bad!
                  &lt;/p&gt;
                &lt;/ion-slide&gt;
              &lt;/ion-slide-box&gt;
            &lt;/ion-view&gt;
          &lt;/script&gt;
      
          &lt;script id="templates/main.html" type="text/ng-template"&gt;
            &lt;ion-view hide-back-button="true" view-title="Awesome"&gt;
              &lt;ion-content class="padding"&gt;
                &lt;h1&gt;Main app here&lt;/h1&gt;
                &lt;button class="button" ng-click="toIntro()"&gt;Do Tutorial Again&lt;/button&gt;
              &lt;/ion-content&gt;
            &lt;/ion-view&gt;
          &lt;/script&gt;
          
        &lt;/body&gt;
      &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p><a href="http://plnkr.co/edit/1FYr6GK6xMQjp9hA3N0M?p=preview" rel="nofollow noreferrer">http://plnkr.co/edit/1FYr6GK6xMQjp9hA3N0M?p=preview</a></p>
  
  <p>Below answer's example works only if the intro state has <code>/</code> as the url route. But if you put <code>/intro</code> or other url, the state kept iterating (screenshot).</p>
  
  <pre><code>function config($stateProvider, $urlRouterProvider) {
    $stateProvider
  
      .state('intro', {
        url: '/intro',
        templateUrl: 'intro.html',
        controller: 'IntroCtrl',
        data: {
          isIntro: true
        },          
      })
  
      .state('main', {
        url: '/main',
        templateUrl: 'main.html',
        controller: 'MainCtrl',
        data: {
          isIntro: false
        },            
      });
  
      $urlRouterProvider.otherwise("/intro");
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/2BYDU.png" alt="enter image description here"></p>