
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
ng2-slides
Advanced tools
This is a small library to create sliding full-height panel effect for Angular2. It has full touch support, keyboard arrow support, and will fall back onto a 'normal' scroll website when the browser height dips below 600px.
Check out a small demo of the package here
You can install this just like you would any other npm package.
npm install --save-dev ng2-slides
First and foremost you need to provide the SlideService
to your application. Preferably you would do this in your Angular2 application bootstrap
import { SlideService } from 'ng2-slides';
boostrap(App, [
SlideService
])
Second you need to use the ng2-slide
component in your template. And Inject the SlideService
using constructor injection.
import { SlideComponent } from 'ng2-slides';
/**
* Example Home Component
*/
import { Component } from '@angular/core';
@Component({
selector: 'home',
directives: [
SlideComponent // <-- Add the SlideComponent
],
template: `
<ng2-slide>
Some content you want in your first slide
</ng2-slide>
<ng2-slide>
Some content you want in your second slide
</ng2-slide>
<ng2-slide>
Some content you want in your third slide
</ng2-slide>
` // <-- use the ng2-slide component as many times as you'd like
})
export class Component {
constructor(
private slide: SlideService // <-- make sure you remember to inject the slide service.
) {}
}
You may add as few or as many slides as you like, everything will be taken care of!
The SlideService will do everything you need it to as part of it's constructor. So all you need to do it inject it, like above!
Suppose you want to naviate to slide 3 from slide 1. Well we can do that with the slide service. Let's use the component above to see how.
import { SlideComponent } from 'ng2-slides';
/**
* Example Home Component
*/
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'home',
directives: [
SlideComponent
],
template: `
<ng2-slide>
Some content you want in your first slide
</ng2-slide>
<ng2-slide>
Some content you want in your second slide
</ng2-slide>
<ng2-slide>
Some content you want in your third slide
</ng2-slide>
`
})
export class Component implements OnInit {
constructor(
private slide: SlideService
) {}
ngOnInit() { // <-- Use OnInit so the components are loaded
this.slide.scrollToIndex(2) // <-- You naviate based on index, so it starts at 0.
}
}
The example above will on startup move to the 3rd slide on the page. Pretty cool!
FAQs
- [github](https://github.com/spittal/ng2-slides) - [npm](https://www.npmjs.com/package/ng2-slides)
The npm package ng2-slides receives a total of 1 weekly downloads. As such, ng2-slides popularity was classified as not popular.
We found that ng2-slides demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.