How can I pass data in two partial html files using angularJS, totally weird cant get through it.
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.
HTML code of partial file: {{post.postText}}
<div class="blog-meta clearfix">
<p class="pull-left">
<i class="icon-user"></i> by <a href="#">{{ post.firstName }} {{ post.lastName }}</a> | <i class="icon-folder-close"></i> Category <a href="#">Food</a> | <i class="icon-calendar"></i> {{post.createdDate.millis | date:'MM/dd/yyyy @ h:mma'}}
</p>
<p class="pull-right"><i class="icon-comment pull"></i> <a href="#/view18#comments" data-ng-click="postDetails(post)">3 Comments</a></p>
</div>
*Controller 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');
}
}]);
* app.js *
$routeProvider.when('/view5', {templateUrl: 'nova/blog.html', controller: 'DemoCtrl'});
$routeProvider.when('/view18', {templateUrl: 'nova/blog-item.html', controller: 'DemoCtrl18'});
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.