简体   繁体   English

ion-slides / ion-slide-page指令无法正确渲染

[英]ion-slides/ion-slide-page directives not rendering properly

I'm trying to implement the ion-slides/ion-slide-page directives into a page on an Ionic App (using an Ionic 1 codebase) I'm currently creating but I can't get each individual ion-slide-page directive to sit horizontally next to each other (with only the currently active page displaying - as per the animated GIF example here: http://ionicframework.com/docs/api/directive/ionSlides/ ) 我正在尝试将Ion-slides / ion-slide-page指令实现到我当前正在创建的Ionic App的页面中(使用Ionic 1代码库),但无法获得每个单独的Ion-slide-page指令并排水平放置(仅显示当前活动页面-如此处的动画GIF示例: http : //ionicframework.com/docs/api/directive/ionSlides/

My controller is structured like so: 我的控制器的结构如下:

 .controller('ProductsController', function($scope, $ionicSlideBoxDelegate, ManageAppDatabase, ) { ManageAppDatabase.retrieveProductsFromDatabaseTable(function(numRecords) { $scope.products = numRecords; $scope.options = { direction: 'horizontal', loop: true, effect: fade, speed: 500 } $scope.data = {}; $scope.$watch('data.slider', function(nv, ov) { $scope.slider = $scope.data.slider; }); }); } 

And the HTML for the associated view is structured like this: 关联视图的HTML结构如下:

 <ion-view title="Products"> <ion-content> <div class="carousel-container"> <ion-slides options="options" slider="data.slider"> <ion-slide-page class="carousel-slide" ng-repeat="product in products"> <img src="{{ product.image }}"> <h1>{{ product.title }}</h1> <small>{{ product.date }}</small> <div class="product-summary" ng-bind-html="product.summary | renderHTMLCorrectly"></div> </ion-slide-page> </ion-slides> </div> </ion-content> </ion-view> 

The CSS (shown as Sass below) used in the above is: 上面使用的CSS(下面显示为Sass)是:

 .carousel-container { background: #e6e6e6; } .carousel-slide { padding:2.5% !important; img { display: block; width: 100%; background: rgb(68, 68, 68); margin: 0; } h1 { padding: 0; } small { display: block; padding: 0 0 1em 0; font-size: 0.85em; } p { padding: 0 0 1.5em 0; font-size:0.9em; line-height:1.3em; } span { display: block; text-align:center; color:rgb(255, 255, 255); font-size: 0.75em; } } 

The HTML view template always loads with EVERY ion-slide-page sat underneath the other, no matter what I do. 无论我做什么,HTML视图模板始终始终将每个离子滑动页放在另一个下方。

Can anyone tell me what I'm missing/doing wrong here? 谁能告诉我我在这里缺少什么/做错了什么? Have spent the last couple of hours trying to get to the bottom of this and I can't make any progress whatsoever. 在过去的几个小时中,我尝试着深入了解这一点,但我无法取得任何进展。

When I run ionic info at the command line this is what I get: 当我在命令行上运行离子信息时,我得到的是:

Cordova CLI: Not installed Gulp version: CLI version 1.2.1 Gulp local: Cordova CLI:未安装Gulp版本:CLI版本1.2.1 Gulp本地:
Ionic Version: 1.3.0 Ionic CLI Version: 1.7.14 Ionic App Lib Version: 0.7.0 ios-deploy version: Not installed ios-sim version: 5.0.8 OS: Mac OS X El Capitan Node Version: v0.10.26 Xcode version: Xcode 7.3 Build version 7D175 Ionic版本:1.3.0 Ionic CLI版本:1.7.14 Ionic App Lib版本:0.7.0 ios部署版本:未安装ios-sim版本:5.0.8 OS:Mac OS X El Capitan节点版本:v0.10.26 Xcode版本:Xcode 7.3 Build版本7D175

Ionic seems up to date although this line: Ionic App Lib Version: 0.7.0 is always there even when I run ionic lib update or create a new ionic project. 尽管此行,但Ionic似乎是最新的:Ionic App Lib版本:即使我运行i​​onic lib update或创建新的ionic项目,也始终存在0.7.0。 Do I need to update anything else here? 我需要在这里更新其他内容吗?

Appreciate any assistance/advice anyone can provide here as this is driving me nuts! 感谢任何人在这里可以提供的帮助/建议,这真让我发疯!

Kind Regards 亲切的问候

I got the same problem as yours. 我遇到了和你一样的问题。

It seems that there something is lacking... 似乎缺少某些东西...

but it seems there is something bizarre in your code. 但是您的代码似乎有些奇怪。 are you sure that the provided controller works correctly? 您确定所提供的控制器正常工作吗?

did you mean the following instead? 您是说以下内容吗?

 .controller('ProductsController', function($scope, $ionicSlideBoxDelegate, ManageAppDatabase, ) { ManageAppDatabase.retrieveProductsFromDatabaseTable(function(numRecords) { $scope.products = numRecords; $scope.options = { direction: 'horizontal', loop: true, effect: fade, speed: 500 } $scope.data = {}; $scope.$watch('data.slider', function(nv, ov) { $scope.slider = ov.slider; }); }); } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM