小编Ali*_*der的帖子

Ui-sref没有在离子框架中生成正确的URL

嗨,我在模板文件夹中有两个名为"home.html"和"home.singleLink.html"的模板.

home.html看起来像这样

<ion-list>  
 <ion-item ng-repeat="link in links">   
  <a class="button button-clear" ui-sref="home({singleLink: link.name})">{{link.name}}</a> 
 </ion-item>
<ion-list>
Run Code Online (Sandbox Code Playgroud)

我想显示"home.singleLink.html"模板,当用户点击ui-sref中的链接时,它会消失"home.html"模板.我在"家"之后传递一个变量

这是我的app.config看起来像

$stateProvider
.state('home', {
  url: '/home',
  templateUrl: 'templates/home.html',
  controller: 'linksController'
})
.state('home.singleLink', {
  url: '/:singleLink',
  templateUrl: 'templates/home.singleLink.html',
  controller: 'linksController'
})
Run Code Online (Sandbox Code Playgroud)

据我所知,当用户点击链接时,ui-sref会生成一个href.但在我的情况下,当我检查链接时,我可以看到一个额外的href ="#/ home"以及ui-sref,当我点击链接时它没有改变.

提前致谢.

angularjs angular-ui-router ionic-framework

4
推荐指数
1
解决办法
9089
查看次数