Skip to content
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

Using without passing element doesn't work #135

Open
hackuun opened this issue Aug 16, 2017 · 1 comment
Open

Using without passing element doesn't work #135

hackuun opened this issue Aug 16, 2017 · 1 comment

Comments

@hackuun
Copy link

hackuun commented Aug 16, 2017

Hi. I was following your guides. This doesn't work.

var _ouibounce = ouibounce(false, {
  callback: function() { console.log('ouibounce fired!'); }
})

How to use this library without ouibounce-modal id?

@sebkolind
Copy link

sebkolind commented Aug 8, 2018

Hello

When you use Ouibounce with first parameter as false you have to do your logic in the callback function. Like for me, in Angularjs (1.x) I do something like this:

function link(scope, el, attrs, ctrl): void {
	/**
	* Passing "false" as first argument allows
	* us to use the plugin without setting it on an element,
	* and instead use the callback function to do our thing.
	*/
	$window.ouibounce(false, {
		callback: () => {
			ctrl.show = !ctrl.show;
			scope.$apply();
		}
	});
}

Do you see "ouibounce fired!" in your console with your example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants