Skip to content

Issue with off-click-filter (again, I know) #51

@ghost

Description

Hey,

Thanks for this directive, it is very handy. Although I have an issue with the off-click-filter :

This is my element that contain an ng-repeat of item (it's a popup menu) :
<div id="fs-create-menu" off-click="fs.closePanel()" off-click-filter="'#fs-file-creator-launcher'"></div>

Which open using a button like :
<button id="fs-file-creator-launcher"><span>Some text</span></button>

Just for matter of testing as you can see, I have set the id of the button in the off-click-filter, so it shouldn't trigger the off-click if I click on the button.

But then it does.

I debugged your source code and tried to understand what went wrong, I can see my filter properly store in the OffClickFilterCache as an object :

{ "#fs-file-creator-launcher": [ { "jQuery224087994817664495642": { "$appsMenuController": {} }, "$$hashKey": "object:856", "$$ngAnimateParentKey": 1 } ] }

So far so good.

And then I come across here https://github.com/TheSharpieOne/angular-off-click/blob/master/dist/angular-off-click.js#L50

What does OffClickFilterCache['*'] should return you ? Because in my case it's undefined. I assume it should return the list of filter passed to off-click-filter, but here I have nothing..
As you could guess, the filters var is [].

Is there something wrong with my logic ? or is there something wrong with the package ?

Also another thing is that you only compare the target element, but then if you want to filter an entire DOM element, you would need to filter ALL the ids and class ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions