我开始使用很棒的 ionic 框架开发一个应用程序。
当然,在您的帮助下,我成功制作了一个效果完美的条纹标签。现在我面临着向 ion-view 内容添加脚本的问题。
这是我的选项卡代码:my ionic tabs CODEPEN
这是我的页面,我想将其集成为选项卡内容:my tab content which i want to ingegrate CODEPEN
我可以做这样的事情吗?
<ion-view title="Home">
<div ng-controller="customersCtrl">
<div class="list">
<div ng-repeat="(competitionname, competition) in MatchesByCompetition">
<div class="item item-divider" >
{{ competition.name }}
</div>
<a class="item" href="#" align="center" ng-repeat="matche in competition.matches" >
<img ng-src="http://media-v4.i-dalgo3.com/Sport/Football/Team/Logo/55x55/logo_{{matche.team1.idTeam}}.png" style="width:28px; height:28px; position:absolute; left:10px; top:12px">
<h4 style=" display:inline-block; left:60px; position:absolute;"> {{matche.team1.name}}</h4> <h5 style=" display:inline-block;"> {{matche.newstartdate}}</h5> <h4 style=" display:inline-block; position:absolute; right:60px; ">{{matche.team2.name}}</h4>
<img ng-src="http://media-v4.i-dalgo3.com/Sport/Football/Team/Logo/55x55/logo_{{matche.team2.idTeam}}.png" style="width:28px; height:28px; position:absolute; right:10px; top:12px" >
</a>
</div>
</div>
</div>
</ion-view>
最佳答案
你能做的是,你可以添加另一个 tab
<ion-tab title="list" ui-sref="list">
<ion-nav-view name="list"></ion-nav-view>
</ion-tab>
而不是使用像 <script type="text/ng-template" id="home.html">
这样的内联脚本你可以告诉ui-router
加载外部页面
在你的路由器中
.state('list', {
url: '/list',
views: {
list: {
controler: 'customersCtrl',
templateUrl: '<path to your file>list.html'
}
}
})
事实上,将所有内联脚本移动到单独的文件中是一个好主意
HTH
关于javascript - 如何将脚本集成到 ionic 选项卡内容中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30393691/