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

Options object in <ons-back-button> #1040

Closed
frandiox opened this issue Nov 13, 2015 · 6 comments
Closed

Options object in <ons-back-button> #1040

frandiox opened this issue Nov 13, 2015 · 6 comments
Assignees
Milestone

Comments

@frandiox
Copy link
Contributor

@argelius @anatoo We can have an options object for navigator.popPage({...}) with things like refresh or onTransitionEnd, but currently ons-back-button is set to do navigator.popPage({cancelIfRunning: true}); and nothing else. I guess we should add a way to assign an options object to ons-back-button. How do you think it should be done?

  • As a parameter of pushPage: `navigator.pushPage( 'newpage.html', { ... , backButtonOptions: { ... } }
  • As attributes in HTML: <ons-back-button options="objectVariableName"> or <ons-back-button refresh="true" onTransitionEnd="functionName">. The last example can be a bit hard to pass functions with arguments.
  • As a method of navigator page object: navigator.getCurrentPage().setBackButtonOptions( { ... } );
  • Any other.

What do you think?

@anatoo
Copy link
Contributor

anatoo commented Nov 19, 2015

👍
It's good to have a way to assign popPage() options such as ons-back-button attributes and pushPage() method's options.

@frandiox frandiox added this to the 2.0 milestone Nov 20, 2015
@frandiox
Copy link
Contributor Author

Which way do you think it's better? I just implemented getter/setter in ons-back-button so it's possible to do it like this: document.querySelector('ons-back-button').options = { ... }. With this I think it's not necessary to add an option to navi.pushPage(...), but what about the HTML attributes? options="myObject", options="JSON" or refresh="true" onTransitionEnd="myFunction" etc.?

@frandiox frandiox self-assigned this Nov 20, 2015
@anatoo
Copy link
Contributor

anatoo commented Nov 20, 2015

Could you write proposal spec shortly? When andreas and I agree its proposal, it's OK to implement.
I personally think it's good to have "refresh-on-pop" and "cancel-if-running" and "on-transition-end" attributes.

@frandiox
Copy link
Contributor Author

@anatoo @argelius We need to pass the options object to ons-back-button somehow. I think we need at least 1 way to do it programmatically and 1 way directly in the HTML of the button:

  • Programmatically: backButtonElement.options = { ... }. I think this is better than passing the object with pushPage since it can be added on init event or page controller and is coherent with web components. Since there is a pointer to the back button in navigator-page-object it's also possible to do myNavigator.getCurrentPage().backButton.options = { ... }.
  • HTML: we can have 1 attribute per option: animation, animationOptions, onTransitionEnd and refresh. Proposed attribute names: animation, animation-options, on-transition-end, refresh.

Attributes have priority over object modifications.

@anatoo
Copy link
Contributor

anatoo commented Nov 25, 2015

👍

@argelius
Copy link
Contributor

I think this looks good!

@lock lock bot added the outdated label May 18, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants