Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

A "pikaday-options" parameter for sending all options without using attributes #12

Closed
mortargrind opened this issue May 23, 2015 · 2 comments

Comments

@mortargrind
Copy link

Hi,

It would be great that user of this directive can send a configuration object to the directive without using element attributes. This object can act similar to default "pikadayConfig" configuration object and it can be applied after the default provider configuration and before applying attribute parameters.

My use case is: I have a custom wrapper directive (for example: "my-app-calendar", isolated scope) that act as a container for "pikaday" element for application specific purposes (changing routes for calendar or doing other calendar related-app specific things). I don't want to define all possible "pikaday" parameters on this directive and delegate them to real "pikaday" directive with attributes.

@nverba
Copy link
Owner

nverba commented May 30, 2015

Hey,

I'm going to be refactoring this to get rid of the switch statement when I get time. I could add this in then.

If I get you right, you want to pass an object with configs as a single attribute?

<input pikaday="myPickerObject" custom-config="myObject">

For clarity, if you could give a code example of how you'd like to pass the config, I'll see what I can do.

@mortargrind
Copy link
Author

Suppose i have a wrapper directive for pikaday called "myapp-calendar". The point of it is that I got some other app-wide common things to do when displaying pikaday and this directive is my proxy or interface to pikaday (in other words: I never use pikaday directive directly). At this point if i want to pass 7 parameters to the actual pikaday: I need to add them as attributes in my wrapper directive and it should search for this pikaday related attributes and copy them to the actual pikaday directive on its compile phase. This is doable but i thought that we can have a secondary method; using an object that hold all configurations (like in pikadayProvider) and just passing it. So my wrapper directive can take it and then delegate it to the actual pikaday directive:

<myapp-calendar pikaday-options="myPikadayOptions">
</myapp-calendar>

in myapp-calendar.html:

<div class="myapp-calendar-container">  
      <input pikaday="myPickerObject" pikaday-options="myPikadayOptions" /> 
</div>

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

2 participants