How to extend angular-ui directive in a clean way? #421

Closed
ni-ka opened this Issue Feb 13, 2013 · 4 comments

Projects

None yet

2 participants

@ni-ka
ni-ka commented Feb 13, 2013

I would like to tweak my select2, which requires to add a bind on 'open' event, see http://jsbin.com/ebalik/1/embed?live. I could just add a directive that enhances the behavior, and then use both the angular-ui directive and my extension, but it doesn't feel very clean.

Is there any best practice scheme to extend / reuse / customize angular-ui directives?

@ProLoser
Member

Have you tried leveraging ui-event?

@ProLoser ProLoser closed this Feb 13, 2013
@ProLoser ProLoser reopened this Feb 13, 2013
@ni-ka
ni-ka commented Feb 13, 2013

Well, I could use ui-event and bind to the 'open' event, but I will need to access and call functions from the select2 component (the goal is to add filters to filter results displayed in the drop down - sorry should have explained). Thus this is not code that should go into the controller.

@ProLoser
Member

I would create a custom directive that simply inserts the select2 AND the ui-event and does whatever you need, etc.

In other words just wrap it.

@ProLoser
Member

Feel free to reopen or mention if you need this reopoened.

@ProLoser ProLoser closed this Feb 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment