Reputation: 125
I've been working on the routing in my application. I have certain data I can work with, but in the end I need someone to click the button and then go to a certain link. This link information is stored in $scope.stories.link
$scope.stories.link = beautyandthebeast.html
<div ng-repeat="stories in lowage">
<ion-list class="ion-list">
<ion-item href="#/app/{{stories.link}}" >
{{stories.title}}
</ion-item>
</div>
Sadly, this doesn't work. Does anyone have a idea how to make this work?
Upvotes: 0
Views: 441
Reputation: 928
you can try with this solution it may work for you
In your Html page update the code as
<ion-list ng-repeat="stories in lowage">
<ion-item ng-click="changeRoute(stories)">
{{stories.title}}
</ion-item>
</ion-list>
and in your controller write the code as
$scope.changeRoute = function(stories){
$location.url('app/'+stories.link);
}
Don't forget to inject $location as dependency
OR
you can use this way also
<ion-list ng-repeat="stories in lowage">
<ion-item ng-href='app/{{stores.link}}'>
{{stories.title}}
</ion-item>
</ion-list>
Upvotes: 1
Reputation: 698
I'm not sure, but I think the problem is that the variable isn't inserted into the code. Your program is trying to go to #/app/{{stories.link}} as it just sees it like a string. You have to use ngHref.
Upvotes: 2