title: How to pass $scope data between two partial files in angularjs
body: <p>How can I pass data in two partial html files using angularJS, totally weird cant get through it.</p>
  
  <p>I have one index file [fine.], I login and reach view5 [partials/blog.html] which is written in DemoCtrl [Fine], all works fine till now. Now when I click on the link in blog.html, it goes to next page but doesnt show any $scope data which I have set in the controller.</p>
  
  <p><strong><em>HTML code of partial file:</em></strong>
          
              
                  {{post.postText}} 
                  
              
          </p>
  
  <pre><code>    &lt;div class="blog-meta clearfix"&gt;
       &lt;p class="pull-left"&gt;
           &lt;i class="icon-user"&gt;&lt;/i&gt; by &lt;a href="#"&gt;{{ post.firstName }} {{ post.lastName }}&lt;/a&gt; | &lt;i class="icon-folder-close"&gt;&lt;/i&gt; Category &lt;a href="#"&gt;Food&lt;/a&gt; | &lt;i class="icon-calendar"&gt;&lt;/i&gt; {{post.createdDate.millis | date:'MM/dd/yyyy @ h:mma'}}
       &lt;/p&gt;
       &lt;p class="pull-right"&gt;&lt;i class="icon-comment pull"&gt;&lt;/i&gt; &lt;a href="#/view18#comments" data-ng-click="postDetails(post)"&gt;3 Comments&lt;/a&gt;&lt;/p&gt;
       &lt;/div&gt;
  </code></pre>
  
  <p><strong>*Controller Code *</strong></p>
  
  <pre><code>    app.controller('DemoCtrl', ['$scope', 'Post', 'ezfb', '$window', 'PFactory', 'PostFactory', '$location', '$timeout', function ($scope, Post, ezfb, $window, PFactory, PostFactory, $location, $timeout) {
          $scope.postDetails = function (post) {
                  $scope.postdetail = {id: null};
                  $scope.postdetail = post;
                  $location.path('/view18');
              }
      }]);    
  </code></pre>
  
  <p><strong>* app.js *</strong></p>
  
  <pre><code>    $routeProvider.when('/view5', {templateUrl: 'nova/blog.html', controller: 'DemoCtrl'});
      $routeProvider.when('/view18', {templateUrl: 'nova/blog-item.html', controller: 'DemoCtrl18'}); 
  </code></pre>
  
  <p>postDetails(post) method in called in DemoCtrl with post object and that post object is been set in $scope.postdetail variable in $scope.postDetail method and view is different template. I can see data coming fine in console in the controller and postDetails method but it is not displayed in template.</p>