Comments (7)
This is a bit out of topic. But do you guys know of any wrapper for this slider in Angular 4?
from swipe.
Great feature! Merged!
from swipe.
Hi @loup-brun , do you mind if I add you as collaborator?
from swipe.
Sure - no problem ;) Happy to help!
from swipe.
Let me know if the multiple directives sound confusing. Maybe there could be a better design, but in respect to the Angular scopes, I think this is a relatively robust architecture.
from swipe.
Using multiple directives is ok to me.
Below is how I use swipe in my angular project for several months ago:
'use strict'
###*
# @ngdoc directive
# @name vetServicesApp.directive:common/swipe
# @description
# # common/swipe
###
angular.module('vetServicesApp.directives')
.directive('swipe', [
'$timeout'
($timeout) ->
restrict: 'AE'
link: (scope, element, attrs) ->
initSwipe = () ->
if scope.mySwipe
scope.mySwipe.kill()
scope.mySwipe = null
scope.mySwipe = new Swipe(element[0],
startSlide: 0
speed: 400
auto: parseInt(attrs.auto)
draggable: true
autoRestart: false
continuous: true
disableScroll: false
stopPropagation: false
callback: (index, elem) ->
angular.element(".swipe-num li")
.removeClass("active")
.eq(index)
.addClass("active")
return
transitionEnd: (index, elem) ->
return
)
return
if attrs.usingNgRepeat
scope.$on 'Event:ng-repeat-finish-render', ->
$timeout(initSwipe, 100)
else
$timeout(initSwipe, 100)
scope.$on 'Event:ImagesLoaded', ->
$timeout ->
scope.mySwipe.setup()
, 100
return
])
There are two things may cause problems when using swipe in angular:
- When using with
ng-repeat
, due to the async process ofng-repeat
, swipe may init before the items are loaded, especially when loading items via Ajax. - Another common problem is when using swipe with images. There are occasions that
swipe
will not perform properly when images are loading with high latency.
So, you can see that I use two additional directives for monitoring ng-repeat
and image loading
status to initiate or setup swipe
.
It is great If these two problems can be fixed with better solutions ^_^
@loup-brun Any good ideas?
from swipe.
I'll have to make some tests with ng-repeat
, since I haven't used Swipe with that directive - though I can see how pertinent it can be.
Since wrapping the Swipe library in Angular brings some compromises, we might (just a quick thought, not yet a serious consideration) port the project to a different repository to better enable Angular support.
from swipe.
Related Issues (20)
- Zoom does not work HOT 1
- Add configurable selector for children to use as a slides HOT 1
- Recalculate widths without changing inline css transition duration HOT 9
- slide(index, duration) does not work HOT 2
- enhancement: add 3 missing props to React documentation HOT 2
- Each slide appears diagonally below the one before it HOT 5
- Question: Is there a way to make what is inside of swipe wrap also clickable? HOT 1
- method of judging amd may cause error:Cannot set property 'Swipe' of undefined
- Multiple Swipe instances? HOT 1
- Using {passive: true} may causes the problem of event conflict on Safari HOT 1
- overlapping slides HOT 2
- A few suggestions HOT 1
- Clicked ignored elements are prevented from default behavior
- Layout is broken if swipe widget is disabled
- react 版本的需要更新一下,升级到16.13.1,应该是16.8以后,componentWillReceiveProps 不建议使用了,等到17就正式不让使用了,麻烦更新一下。 HOT 1
- Layout jump after init HOT 2
- Flex direction row-reverse not working? HOT 1
- continuous为true且children个数为两个时显示有问题 HOT 1
- Desktop weirdness... HOT 1
- slide function directions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swipe.