1

I want to navigate to another page without reloading the controller:

  .state('app.viewcomments', {
    url: '/viewcomments/?new',
    views: {
      'menuContent': {
        templateUrl: 'templates/posts/view-comment.html',
        controller: 'SearchController'
      }
    }
  })  

What i want is if I navigate to this url from anywhere it should not reload SearchController based on this solution it tried :

  <a href="#/app.viewcomments/?new" class="button button-icon icon ion-plus-round"></a>
  <a href="#app.viewcomments/?new" class="button button-icon icon ion-plus-round"></a>
  <a href="app.viewcomments/?new" class="button button-icon icon ion-plus-round"></a>

but none of them worked.

Community
  • 1
  • 1
Manish Kumar
  • 10,214
  • 25
  • 77
  • 147
  • What are you trying to accomplish? Persisting data is usually a job for factories or services – Jorg Sep 29 '15 at 04:33
  • actually have form that i need to open frequently so i dont want to reload the controller whenever i came back from that form page – Manish Kumar Sep 29 '15 at 04:44
  • The question you linked uses a parameter to load different partials into the same view (hence no controller reload). It also uses ng-route instead of ui-route so you can't directly compare your case to his. – Jorg Sep 29 '15 at 05:21
  • Why you don't want to reload the controller? Is there a notable performance issue? Usually the user is by far the slowest component in the system. If you don't have any issues I'd just create a new instance as it is. KISS - Keep it simple, Stupid{ – Michael Sep 29 '15 at 06:45
  • i load data when controller is loaded. now let say i open a form and then want to go back then again it will load the same data again inside controller – Manish Kumar Sep 29 '15 at 06:47
  • i found this solution http://stackoverflow.com/a/27453442/1049104 – Manish Kumar Sep 29 '15 at 07:11

0 Answers0