title: Routing/Navigation bug in Cordova
body: <p>I have an Angular JS app and I would like to use it with Cordova. In the browser the Angular app works fine. On Cordova however, the navigation is very buggy. I tried the ngRoute and the ui-router methods, but both show similar problem.</p>
  
  <p>The problem is as follows: I go to a state (newsitem), the controller of a newsitem fetches the local storage (made in a service where externally JSON feed is loaded), so far so good. The item is showing properly.</p>
  
  <p>However, when I scrolll down, I automatically return to the / state.</p>
  
  <p>M code is as follows:</p>
  
  <pre><code>app.config(function ($stateProvider, $urlRouterProvider) {
    $urlRouterProvider.otherwise("/");
    $stateProvider
      .state('/', {
        url: '/',
        templateUrl: 'pages/homepage.html',
        controller: 'homeNewsCtrl',
        resolve: {
          newsList: function (newsItemFactory) {
            return newsItemFactory.getNewsItems();
          }
        }
      })
      .state('newsitem', {
        url: '/newsitem:id',
        templateUrl: 'pages/newsitem.html',
        controller: 'newsItemCtrl'
      })
  });
  
  app.controller('homeNewsCtrl', function ($scope, newsList) {
  
    $scope.count = 1;
    $scope.newsItems = newsList.data;
  
  
    window.localStorage['News'] = JSON.stringify(newsList.data);
    var newsLocal = window.localStorage['News'];
    var parsedNewsItems = JSON.parse(newsLocal);
  
    $scope.mainID = parsedNewsItems[0].id;
    $scope.mainTitle = parsedNewsItems[0].title.rendered;
    $scope.mainImage = parsedNewsItems[0].better_featured_image.source_url;
  
  });
  
  app.controller('newsItemCtrl', function ($scope, $stateParams, commentItems) {
    var postid = $stateParams.id;
    var newsLocal = window.localStorage['News'];
    var parsedNewsItem = JSON.parse(newsLocal);
    $scope.newsItem = parsedNewsItem[postid];
    $scope.commentItems = [];
  
    commentItems.getComments($scope.newsItem.id, null).then(function (response) {
      $scope.commentItems = response.data;
      console.log($scope.commentItems);
    });
  });
  </code></pre>
  
  <p>homepage.html</p>
  
  <pre><code>&lt;div class="homenews"&gt;
    &lt;ul class="unstyled"&gt;
      &lt;li bindonce ng-repeat="item in newsItems track by $index" class="newsitem"&gt;
        &lt;a href="#/newsitem{{$index}}"&gt;
          &lt;div class="newsimage"
               style="background-image: url('{{ item.better_featured_image.media_details.sizes.medium.source_url }}');"&gt;&lt;/div&gt;
          &lt;h2 ng-bind-html="item.title.rendered"&gt;&lt;/h2&gt;
          &lt;span class="comment-count"&gt;{{item.date | date:'dd-MM-yyyy' }}&lt;/span&gt;
        &lt;/a&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>newsitem.html</p>
  
  <pre><code>&lt;div class="item single"&gt;
    &lt;div class="newsimage" style="background-image: url('{{ newsItem.better_featured_image.source_url }}');"&gt;
      &lt;h2 ng-bind-html="newsItem.title.rendered"&gt;&lt;/h2&gt;
    &lt;/div&gt;
    &lt;div class="inner"&gt;
      &lt;h3 class="meta"&gt;{{newsItem.date | date:'dd-MM-yyyy' }}&lt;/h3&gt;
  
      &lt;div class="news-item"&gt;
        &lt;p ng-bind-html="newsItem.content.rendered"&gt;&lt;/p&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="comments-container"&gt;
    &lt;div class="comments"&gt;
      &lt;ul class="unstyled" infinite-scroll='loadMoreComments(1)'
          infinite-scroll-distance='1'&gt;
        &lt;li class="item" ng-repeat="comment in commentItems"&gt;
          &lt;h4&gt;{{comment.author_name}} &lt;span class="right"&gt;{{comment.date | date:'dd-MM-yyyy' }}&lt;/span&gt;&lt;/h4&gt;
  
          &lt;div ng-bind-html="comment.content.rendered"&gt;&lt;/div&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>