i trying inherit blog contents blog.html(list of cards) news.html(single card) . cant seem working. here config :
app.js
.controller('blogctrl', function($scope, $state, posts) { $scope.blogs = []; posts.success(function(response) { var posts = response; $scope.blogs = posts; }) .state('app.news', { url: "/news/:index", views: { 'menucontent': { templateurl: "templates/news.html" } }})
blogctrl.js
$scope.monitor = function(index){ $state.go('app.news',{ index: index }); };
blog.html
<div ng-controller="blogctrl"> <div ng-repeat="blog in blogs | orderby:'-created_at'" ng-click="monitor($index)"> <h4 class="title">{{blog.title}} </h4> </div> </div>
news.html
<ion-view view-title="{{blog.title}}"> <ion-content> <div class="list card"> <div class="item"> <h3 ng-bind="{{blog.title}}"></h3> <p ng-bind="{{blog.created_at}}"></p> </div> <div class="item item-body"> <img class="full-image" ng-src="{{blog.img}}"> <div ng-bind="{{blog.text}}"></div> </div> </div> </ion-content> </ion-view>
Comments
Post a Comment