Comments (9)
Yes, I actually have made some changes to this to do just that, as well as clean up the code so cookies are more optional.
I say more optional because I haven't figured out a way to have an optional dependency in a module with angularJS, so even if you disable cookies you still will need a angular-cookie script somewhere in your app. But I would like there to be a viable alternative to using the tour with cookies.
I'll push that a little later today, I want to go over it a bit first and see if it needs any more tests.
Edit: Oh I see you said ngCookies. Actually what I was talking about was using angular-cookie, https://github.com/ivpusic/angular-cookie. ngCookie unfortunately doesn't let you set the cookies expiration date, which makes it useless for this purpose :(
from angular-tour.
Ohh didn't realize that ngCookies doesn't let you set things like that - how pointless.
As far as an optional dependency, what about something like this:
try {
cookie.function(args);
} catch (e) {
if (!(e instanceof ReferenceError)) {
throw e;
}
}
Basically if cookie.function is not available because of a ReferenceError, nothing will be thrown.
from angular-tour.
The problem is with the angular module system though. To be able to inject the cookie service into my services I need to register the cookie module with angular, e.g.
angular.module('angular-tour', ['cookieModule']);
If the cookie module isn't included in the app, angular will throw an error that I don't think I can catch.
from angular-tour.
ahh. missed the point there. i'm not sure how to overcome that. thanks for the continued work on angular-tour! looking forward to seeing your latest work
from angular-tour.
I've thought about this a little more and I'd love to get your feedback on this.
I'm thinking about just removing cookies altogether from the tour, and have a tour directive just keep track of the currentStep. If the current step is greater than the number of steps in the tour, it is assumed to be completed.
This would solve a lot of the problems with flexibility, as you can use whatever storage method you want to save the currentStep, and load the tour from that.
from angular-tour.
Sorry I won't be able to get this up today. Since I've changed my approach its going to take longer than I thought to have something working. I'll try to push a working version tomorrow though :)
from angular-tour.
No problem! I like the idea of getting rid of cookies - a flexible storage adapter opens up lots of possibilities
from angular-tour.
@DaftMonk I'm with you. It's up to the developer to use ngCookies, angular-cookie, web storage or whatever.
Thanks for the great tool.
from angular-tour.
Finally got the chance to release the version with the changes I talked about. Take a look at the updated demo/readme for example usage. Let me know how it works :)
from angular-tour.
Related Issues (20)
- Does this directive have any Back option? HOT 1
- Demo page does have an compile error
- Getting error in calculating the position.
- bower.json missing css
- center-top placement hides arrow
- not working HOT 1
- tourtip-element will not be found in a template of an 1.5-component HOT 1
- Not working with jQuery 3 HOT 2
- tourtip-element
- Unable to restart the tour once final step has reached HOT 1
- Call open Tour programmatically HOT 1
- Demo does not work
- need auto-play feature with delay to minimize user clicks
- Please Add Support for Angular 2
- "Target element could not be found" Fallback
- openTour not working HOT 3
- how to adapt tour to mobile view?
- How to skip a step if I want to apply certain condition ? HOT 2
- Does this works with ui-router?
- Backdrop appended twice when going through steps
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 angular-tour.