{"_id":"@duxor/ngx-useful-swiper","_rev":"1-18161e6a07763942008cffbaf652fd95","name":"@duxor/ngx-useful-swiper","dist-tags":{"latest":"18.0.0"},"versions":{"17.0.0":{"name":"@duxor/ngx-useful-swiper","version":"17.0.0","keywords":["Angular","swiper","slider","carousel"],"author":{"name":"JayChase"},"license":"MIT","_id":"@duxor/ngx-useful-swiper@17.0.0","maintainers":[{"name":"duxor","email":"dullle@live.com"}],"homepage":"https://github.com/duxor/angular2-useful-swiper#readme","bugs":{"url":"https://github.com/duxor/angular2-useful-swiper/issues"},"dist":{"shasum":"ea45c87ec0a9cd8ca271875b75529b376033df5d","tarball":"https://registry.npmjs.org/@duxor/ngx-useful-swiper/-/ngx-useful-swiper-17.0.0.tgz","fileCount":14,"integrity":"sha512-gTyg1iEa7AUdNBibpbBRO1S5/ZnAD9oDTQB1PwVv2DsRiOW5rLunoOXLdOMZK+5qFvJaARxfKiMqEa9bnL/pvg==","signatures":[{"sig":"MEUCIQDVsU89cFG6epbSdakpRhouFfhx49c8o1gw1ACdWCsH+gIgA+VwfS31tn4vO8wkWQFgbCkJrLKD3IbfBv+qRjmxPyc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":42216},"module":"fesm2022/duxor-ngx-useful-swiper.mjs","exports":{".":{"esm":"./esm2022/duxor-ngx-useful-swiper.mjs","types":"./index.d.ts","default":"./fesm2022/duxor-ngx-useful-swiper.mjs","esm2022":"./esm2022/duxor-ngx-useful-swiper.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"c298a2128e0776625eb7060f4e71c2d4e8f121f3","typings":"index.d.ts","_npmUser":{"name":"duxor","email":"dullle@live.com"},"repository":{"url":"git+https://github.com/duxor/angular2-useful-swiper.git","type":"git"},"_npmVersion":"10.2.3","description":"Use iDangero.us's great slider [Swiper](http://idangero.us/swiper/#.V9C3w4VOLaI) in Angular.","directories":{},"sideEffects":false,"_nodeVersion":"18.19.0","dependencies":{"tslib":"^2.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"swiper":"^6.0.0","@angular/core":">=17.0.0 <18.0.0","@angular/common":">=17.0.0 <18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ngx-useful-swiper_17.0.0_1710187782008_0.23977493750091594","host":"s3://npm-registry-packages"}},"18.0.0":{"name":"@duxor/ngx-useful-swiper","version":"18.0.0","repository":{"type":"git","url":"git+https://github.com/duxor/angular2-useful-swiper.git"},"bugs":{"url":"https://github.com/duxor/angular2-useful-swiper/issues"},"keywords":["Angular","swiper","slider","carousel"],"author":{"name":"JayChase"},"license":"MIT","dependencies":{"tslib":"^2.0.0"},"peerDependencies":{"@angular/common":">=17.0.0 <19.0.0","@angular/core":">=17.0.0 <19.0.0","swiper":"^6.0.0"},"module":"fesm2022/duxor-ngx-useful-swiper.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2022":"./esm2022/duxor-ngx-useful-swiper.mjs","esm":"./esm2022/duxor-ngx-useful-swiper.mjs","default":"./fesm2022/duxor-ngx-useful-swiper.mjs"}},"sideEffects":false,"_id":"@duxor/ngx-useful-swiper@18.0.0","gitHead":"b473202a623a0912f2ce3d2e6ac3f78a0ce0f36f","description":"Use iDangero.us's great slider [Swiper](http://idangero.us/swiper/#.V9C3w4VOLaI) in Angular.","homepage":"https://github.com/duxor/angular2-useful-swiper#readme","_nodeVersion":"20.17.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-zTHNqZEuuAKAH223vYPnco1OiFfhCNp+lmVIxBc9vT6vpw/EkLa69bvIJt3C98gL8uGOcQCkABCnErGG0vERFQ==","shasum":"aea3e8bca8b7218f2b24e75a629f82ab5f18942c","tarball":"https://registry.npmjs.org/@duxor/ngx-useful-swiper/-/ngx-useful-swiper-18.0.0.tgz","fileCount":14,"unpackedSize":42218,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQChqkustaMXZAlfTSJtYhHFBZzNdsJ+W1AEbsSn6Aen3gIhAJGhI4I5EgDKygfPE2JPhwGgcXj+el+ne//FMg45izNo"}]},"_npmUser":{"name":"duxor","email":"dullle@live.com"},"directories":{},"maintainers":[{"name":"duxor","email":"dullle@live.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ngx-useful-swiper_18.0.0_1725565665835_0.5682058789662376"},"_hasShrinkwrap":false}},"time":{"created":"2024-03-11T20:09:41.887Z","modified":"2024-09-05T19:47:46.217Z","17.0.0":"2024-03-11T20:09:42.162Z","18.0.0":"2024-09-05T19:47:46.007Z"},"bugs":{"url":"https://github.com/duxor/angular2-useful-swiper/issues"},"author":{"name":"JayChase"},"license":"MIT","homepage":"https://github.com/duxor/angular2-useful-swiper#readme","keywords":["Angular","swiper","slider","carousel"],"repository":{"type":"git","url":"git+https://github.com/duxor/angular2-useful-swiper.git"},"description":"Use iDangero.us's great slider [Swiper](http://idangero.us/swiper/#.V9C3w4VOLaI) in Angular.","maintainers":[{"name":"duxor","email":"dullle@live.com"}],"readme":"## ngx-useful-swiper\n\nUse iDangero.us's great slider [Swiper](http://idangero.us/swiper/#.V9C3w4VOLaI) in Angular.\n\n#### Quick links\n\n- [Demo (StackBlitz)](https://stackblitz.com/edit/ngx-useful-swiper)\n- [Swiper homepage](http://idangero.us/swiper/#.WTiywWiGNhE)\n\n### Install\n\n```bash\nnpm install --save ngx-useful-swiper@latest swiper\n```\n\nAdd the swiper styles to the app styles in **angular.json**.\n\n```json\n{\n  \"$schema\": \"./node_modules/@angular/cli/lib/config/schema.json\",\n  \"version\": 1,\n  \"newProjectRoot\": \"projects\",\n  \"projects\": {\n    \"demo\": {\n      ...\n      \"architect\": {\n        \"build\": {\n          \"builder\": \"@angular-devkit/build-angular:browser\",\n          \"options\": {\n            ...\n            \"styles\": [\n              \"./node_modules/swiper/swiper-bundle.css\",\n            ],\n            ...\n```\n\n### Usage\n\nIn **app.module.ts** (or in whichever child module you are using the component) import the **NgxUsefulSwiperModule** module.\n\n```typescript\nimport { NgxUsefulSwiperModule } from 'ngx-useful-swiper';\n\n@NgModule({\n  declarations: [AppComponent],\n  imports: [BrowserModule, NgxUsefulSwiperModule],\n  providers: [],\n  bootstrap: [AppComponent],\n})\nexport class AppModule {}\n```\n\nAdd the swiper component to your component to create a slider and add the content as you normally would to set up a slider (see the official [demos](http://idangero.us/swiper/demos/#.V9C73YVOLaI) for more information).\nNote, you don't need to include the **swiper-container** div just the content, but the slides should be contained in a **swiper-wrapper** div and have the class **swiper-slide**.\n\n```html\n<my-component>\n  <swiper [config]=\"config\">\n    <div class=\"swiper-wrapper\">\n      <div class=\"swiper-slide\">Slide 1</div>\n      <div class=\"swiper-slide\">Slide 2</div>\n      <div class=\"swiper-slide\">Slide 3</div>\n      <div class=\"swiper-slide\">Slide 4</div>\n      <div class=\"swiper-slide\">Slide 5</div>\n      <div class=\"swiper-slide\">Slide 6</div>\n      <div class=\"swiper-slide\">Slide 7</div>\n      <div class=\"swiper-slide\">Slide 8</div>\n      <div class=\"swiper-slide\">Slide 9</div>\n      <div class=\"swiper-slide\">Slide 10</div>\n    </div>\n    <!-- Add Pagination -->\n    <div class=\"swiper-pagination\"></div>\n    <!-- Add Arrows -->\n    <div class=\"swiper-button-next\"></div>\n    <div class=\"swiper-button-prev\"></div>\n  </swiper>\n</my-component>\n```\n\nSet the config for the swiper in you component and bind it to the component config property as above.\n\n```javascript\nimport { SwiperOptions } from 'swiper';\n\n\nexport class MyComponent implements OnInit {\nconfig: SwiperOptions = {\n    pagination: { el: '.swiper-pagination', clickable: true },\n    navigation: {\n      nextEl: '.swiper-button-next',\n      prevEl: '.swiper-button-prev'\n    },\n    spaceBetween: 30\n  };\n```\n\nSet the height and width of the component.\n\n```css\nswiper {\n  height: 300px;\n  width: 400px;\n}\n```\n\nThe component also checks for the contents of swiper-wrapper being changed and calls update on the swiper when they are.\nThis allows for dynamic slide lists as you can see from the demo in this repo.\n\n```html\n<swiper [config]=\"config\">\n  <div class=\"swiper-wrapper\">\n    <img class=\"swiper-slide\" *ngFor=\"let image of images\" [src]=\"image\" />\n  </div>\n  <div class=\"swiper-pagination\"></div>\n  <div class=\"swiper-button-next\"></div>\n  <div class=\"swiper-button-prev\"></div>\n</swiper>\n```\n\n**note for Bootstrap users**\n\nTo ensure the swiper works will with a column layout you may need to set the box-sizing to border-box on the swiper-wrapper.\n\n```css\n.swiper-wrapper {\n  box-sizing: border-box;\n}\n```\n\n#### Manually initializing the Swiper\n\nBy default the Swiper will be created in the **AfterViewChecked** event of the component. If the swiper is not going to have been rendered at this time (if it is on a hidden tab for example), it is best to handle the initialization manually.\nTo do this use the component's **initialize** property and only set it's value to true when ready. This will then initialize the Swiper the next time the next AfterViewChecked event is fired to ensure the DOM is ready.\n\n```html\n<mat-tabs mat-ripple mat-tab-active-index=\"0\">\n  <mat-tab-panel mat-tab-panel-title=\"Tab1\"> </mat-tab-panel>\n  <mat-tab-panel mat-tab-panel-title=\"Tab2\" #panel>\n    <swiper [config]=\"config\" class=\"wrap1\" [initialize]=\"panel.isActive\">\n      <div class=\"swiper-wrapper wrap1\">\n        <img\n          class=\"swiper-slide\"\n          *ngFor=\"let image of trigger.images\"\n          [src]=\"image\"\n        />\n      </div>\n      <div class=\"swiper-pagination\"></div>\n      <div class=\"swiper-button-next\"></div>\n      <div class=\"swiper-button-prev\"></div>\n    </swiper>\n  </mat-tab-panel>\n</mat-tabs>\n```\n\n#### Accessing the Swiper instance\n\nWhen a new instance of Swiper is created it is set as a property on the component. You can then access this by using a [template reference](https://angular.io/docs/ts/latest/guide/template-syntax.html#!#ref-vars).\nFor example add the template reference **#usefulSwiper**\n\n```html\n<swiper [config]=\"config\" #usefulSwiper>\n  <div class=\"swiper-wrapper\">\n    <img class=\"swiper-slide\" *ngFor=\"let image of images\" [src]=\"image\" />\n  </div>\n  <div class=\"swiper-pagination\"></div>\n  <div class=\"swiper-button-next\"></div>\n  <div class=\"swiper-button-prev\"></div>\n</swiper>\n```\n\n..and then you can use the reference to access the **swiper** property.\n\n```html\n<button (click)=\"usefulSwiper.swiper.createLoop()\">loop</button>\n```\n\nTo access the swiper instance and all of it's properties, methods and events use a viewchild to get the component.swiper property.\n\n```typescript\n @ViewChild('usefulSwiper',{static: false S}) usefulSwiper: SwiperComponent;\n\n ...\n\n  next() {\n    this.usefulSwiper.swiper.slideNext();\n  }\n```\n","readmeFilename":"README.md"}