Hello guys, I am creating a RSS feed app but I don’t how to fix when clicking in an item to get to it’s html page by some
a href="#/singlepost/{{$id}}"
Can someone please help me solve this?
Here is my App.js:
var app = angular.module('starter', ['ionic']);
app.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/')
$stateProvider
.state('home', {
url: '/',
controller: 'RSSCtrl',
templateUrl: 'home.html'
})
.state('app.posts', {
url: '/singlepost/:id',
controller: 'PostCtrl',
templateUrl: 'singlepost.html',
});
});
app.controller('RSSCtrl', function($scope, $http, $rootScope) {
$http.get("http://ideiasfmc.com/blog/api/get_posts/")
.success(function(response) {
$scope.postscope = response.posts;
});
// $scope.browse = function(v) {
// window.open(v, "_blank", "location=yes");
// };
//working: opens website
});
app.controller('PostCtrl', function($scope, $stateParams, $rootScope) {
$scope.index = $stateParams.index;
})
And here is my home.html file:
<ion-content class="padding">
<ion-list class="list list-inset">
<ion-item ng-repeat="post in postscope" class="item item-thumbnail-left" href="#/singlepost/{{post.id}}">
<img src="{{post.thumbnail_images.full.url}}">
<h2>Título: {{post.title}}</h2>
<p>{{post.excerpt}}</p>
<br>
</ion-item>
</ion-list>
</ion-content>
Thanks.