Ionic Picture Carousel Problem

Source: Internet
Author: User

1, the use of ion-slide can achieve picture carousel, but if in the HTML only add Ion-slide is not enough, there will be two problems:

(Note: Angularjs is used.) First need to inject in, JS file: $ionicSlideBoxDelegate)

One, sometimes the picture can not be loaded out. The solution is:

Add $ionicSlideBoxDelegate to the corresponding controller file. Update ();

Second, the issue of Carousel to the last non-rotation, the solution is:

Add $ionicSlideBoxDelegate. Loop (True) in the corresponding controller file;

The code is as follows:

1 function Getmessageinface () {2              vm.condition = {//Enter parameter 3                  "Sysid":4                               }; 6              Service. Post (' advertisement ', ' Findeffectivedatainfo ', vm.condition). Then (function(data) {7                   Console.log (data) 9                  VM. adlists = data;10 Angular.foreach (VM. Adlists, Function(index) {one//STATEMENTS12//Console.log ("Loop increase Imgurl"), if (Index.pic.indexOf ("http") < 0< c15>) {index.pic = Vm.imgurl + });       

The injection method is as follows:

(function () {
Angular.module (' app '). Controller (' Goodslistctrl ', Goodslistctrl);
Goodslistctrl. $inject = [' $scope ', ' $state ', ' Service ', ' $stateParams ', ' $localStorage ', ' $ionicSlideBoxDelegate ', ' $ Ionicpopup '];

function Goodslistctrl ($scope, $state, Service, $stateParams, $localStorage, $ionicSlideBoxDelegate, $ionicPopup) {
var vm = this;

......

......

}

})();

Third, the use of $ionicslideboxdelegate.loop (true) there will be a problem that has not been thought to understand: loading two pictures will show four, that is, the two will be repeated, the other conditions are normal. So my final solution is to implement manual carousel based on official documentation ...



Ionic Picture Carousel Problem

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.