javascript - Click list item, page transits but details page shows only no item details except for () -



currently, main list html works

 <div class="post row" ng-repeat="(postid, post) in posts">    <a href="{{ post.url }}">{{ post.title }}</a> 

but when click item (one of many in list) , go page, new page not display item in detail?


when add line below, including $stateparams in dependencies, controller js file, {{ post.title }} appears data not pass through.

$scope.post = $scope.posts[$stateparams.id] 



update
states code. (ignore missing syntax...im shortening it). helped resolved previous issue , provided below codes viewing part (the last 2 states).

  .state('tab.view', {        url: '/posts/:postid',       views: {         'tab-view': {           templateurl: 'templates/tab-showpost.html',           controller: 'postviewctrl' 



how details access after clicking on list item.

app.controller('postviewctrl', function ($scope, $stateparams, post) {     $scope.post = post.find($stateparams.postid);   //i think may broken 

one key piece missing in question how stateprovider configured. please ensure states have url set correctly send data though state parameters. have a codepen here shows 1 way to have list of items clicking on 1 take user it's details. note how states set up...

angular.module('ionicapp', ['ionic'])  .config(function($stateprovider, $urlrouterprovider) {    $stateprovider     .state('tabs', {       url: "/tab",       abstract: true,       templateurl: "tabs.html"     })     .state('tabs.home', {       url: "/home",       views: {         'home-tab': {           templateurl: "home.html",           controller: 'hometabctrl'         }       }     })     .state('tabs.detailview', {       url: "/detailview/:index", //note: :index how use $stateparams later on.       views: {         'home-tab': {           templateurl: "detailview.html",           controller: 'detailviewtabctrl'         }       }     });      $urlrouterprovider.otherwise("/tab/home");  }); 

then, in controller...

.controller('detailviewtabctrl', function($scope,$stateparams) {   $scope.id = parseint($stateparams.index);//note: same 'index'    $scope.previous = parseint($stateparams.index) - 1;   $scope.next = parseint($stateparams.index) + 1; }); 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -