-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mark
committed
Jun 14, 2017
1 parent
3a63839
commit 84a118e
Showing
4 changed files
with
49 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ import { NgModule } from '@angular/core'; | |
import { AppComponent } from './app.component'; | ||
|
||
// Import your library | ||
import { SampleModule } from 'ngx-slick'; | ||
import { SlickModule } from 'ngx-slick'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
|
@@ -35,24 +35,60 @@ import { SampleModule } from 'ngx-slick'; | |
BrowserModule, | ||
|
||
// Specify your library as an import | ||
LibraryModule | ||
SlickModule.forRoot() | ||
], | ||
providers: [], | ||
bootstrap: [AppComponent] | ||
}) | ||
export class AppModule { } | ||
``` | ||
|
||
- Include jquery and slick css/js in your application : | ||
``` | ||
<script src="//code.jquery.com/jquery-3.2.1.min.js"></script> | ||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.6.0/slick.css"/> | ||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.6.0/slick-theme.css"/> | ||
<script src="https://unpkg.com/[email protected]/slick/slick.js"></script> | ||
``` | ||
|
||
Once your library is imported, you can use its components, directives and pipes in your Angular application: | ||
```html | ||
<!-- You can now use your library component in app.component.html --> | ||
<ngx-slick class="carousel" #slickModal="slick-modal" [config]="slideConfig" (afterChange)="afterChange($event)"> | ||
<div ngxSlickItem *ngFor="let slide of slides" class="slide"> | ||
<img src="{{ slide.img }}" alt="" width="100%"> | ||
</div> | ||
</ngx-slick> | ||
|
||
<button (click)="addSlide()">Add</button> | ||
<button (click)="removeSlide()">Remove</button> | ||
<button (click)="slickModal.slickGoTo(2)">slickGoto 2</button> | ||
<button (click)="slickModal.unslick()">unslick</button> | ||
``` | ||
|
||
```xml | ||
<!-- You can now use your library component in app.component.html --> | ||
<h1> | ||
{{title}} | ||
</h1> | ||
<sampleComponent></sampleComponent> | ||
```javascript | ||
slides = [ | ||
{img: "http://placehold.it/350x150/000000"}, | ||
{img: "http://placehold.it/350x150/111111"}, | ||
{img: "http://placehold.it/350x150/333333"}, | ||
{img: "http://placehold.it/350x150/666666"} | ||
]; | ||
slideConfig = {"slidesToShow": 4, "slidesToScroll": 4}; | ||
|
||
addSlide() { | ||
this.slides.push({img: "http://placehold.it/350x150/777777"}) | ||
} | ||
|
||
removeSlide() { | ||
this.slides.length = this.slides.length - 1; | ||
} | ||
|
||
afterChange(e) { | ||
console.log('afterChange'); | ||
} | ||
``` | ||
|
||
|
||
## Development | ||
|
||
To generate all `*.js`, `*.d.ts` and `*.metadata.json` files: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters