我有一个充满文章的数组,显示一个元素:
$scope.articles = [];
//New article
var article = {};
article.heading = "A DISCUSSION WITH ATHEISTS ON EVOLUTION";
article.date = "December 24, 2017";
article.description = "The point of my discussion was to attempt to convince a relatively large group of atheists in r/DebateAnAtheist that the theory of evolution which they hold on to so dearly is in fact a random process. It is generally maintained that evolution is not random due to natural selection. This idea, however, is fundamentally flawed.";
article.link = "evolution-debate";
article.img = "templates/articles/evolution-debate/darwin.jpg";
//Add to array
$scope.articles.push(article);
我想把我的状态改为进化论辩论状态:
.state("evolution-debate", {
url: "/evolution-debate",
templateUrl: "templates/articles/evolution-debate.html",
controller: 'articles'
})
但是因为我从数组加载我的文章,我需要使用我的数组对象中的article.link属性来更改状态。
我目前正在使用此代码,但它不会更改状态:
<ul class="actions">
<li><a ng-click="go('{{article.link}}')" class="button big">READ NOW</a></li>
</ul>
任何帮助,将不胜感激。
您可以使用ui-sref导航到您的文章
<a ui-sref="{{article.link}}">READ NOW</a>