New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax error when binding to Hammer.js gestures when Hammer.js is not loaded #16992

Closed
wesleycho opened this Issue May 24, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@wesleycho
Contributor

wesleycho commented May 24, 2017

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior
If one is binding to a hammer.js gesture such as swipe and hammer.js is not loaded, platform-browser throws an error, i.e.

Error: Hammer.js is not loaded, can not bind swipe event

Expected behavior
Angular displays a warning that can be stripped out for production builds, and ignore binding to the gesture if hammer.js is not loaded.

What is the motivation / use case for changing the behavior?
For supporting mobile in libraries such as https://ng-bootstrap.github.io, we would like the ability to provide built in support for swipe gestures via hammer.js, but allow them to be opt-in so that if a user is using the carousel component (for example), one can use it without having to load hammer.js - this is important for users who want to build sites not intended for mobile, and so don't need that dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment