-
Notifications
You must be signed in to change notification settings - Fork 822
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
Angular Plugin: Removed isolate scope, added onPin, onUnpin, onTop, onNotTop events. #114
base: master
Are you sure you want to change the base?
Conversation
Much better indeed. I'd also created my own version of the directive, using transclusion, something like:
I guess this would be great to have as well. |
@spaceribs I don't think it is working, have you tested it? |
@JobaDiniz can you give me an example of how you're using it? |
Does not work Works
But then, we need to change to valid JSON |
And fix the $destroy event name, as proposed here: #104 |
Here's my contribution: https://gist.github.com/JobaDiniz/c14280ca3d7f33ca4287 |
I'm not familiar enough with angular to understand the reason for the change (or the correctness of it tbh!). Can you give a demo of what this change adds to the feature set (e.g. your use case in the description, hiding the subnav, would be good). What about the issues @JobaDiniz identified (also should probably remove that console.log :)? |
The callbacks (onPin, onTop, etc) should be bindable, so that's essentially what @spaceribs commit is doing. @WickyNilliams I could create a PR with my contribution. What I did, besides improving @spaceribs code, was to add transclusion to the directive, which makes much more sense if you think about.
And I think the directive should be used only like a html element, and never like an attribute (again, for me it just makes more sense). Moreover, I add code to enable/disable the headroom, which in turn will call |
yep, I would take @JobaDiniz code, I didn't test some of the features he checked but the main idea was that isolating the scope prevented anything from communicating outside of the directive, and in my case I wanted to communicate from ui-router into the header to close a menu in mobile. |
Sorry for the delay all. Life got in the way. I've read through this again, and still have no idea whether to accept. My angular skills are near zero, and there's so much angular-specific vocabulary (transclusion! directive! isolate scope!) that it's hard for me to understand. I may call on a friend with some angular experience to assist :) |
@JobaDiniz @WickyNilliams |
Do you want a review on this @WickyNilliams? Happy to refactor existing Angular PR to use |
@toddmotto what's the deal with this now that your other angular PR has been merged? What @JobaDiniz was saying above, about it being an element and not an attribute seemed to make sense. But all this angular stuff confuses the hell out of me :P |
Well, the PR is pretty old now - ideally we should use isolate scopes rather than full inheritance. Happy to take some of the existing code and make a new PR, we'd need to consider what you want data-bound versus delegated functions. If you're delegating functions we should use |
@toddmotto agreed, adding something like |
OK cool. I'm done for today, I'll open an issue tomorrow, and ping you guys. 👍 |
I removed the isolate scope, it's only hooked up to initialization right now anyway, so it shouldn't need to be bound and you can now apply your own ng-controller on an element with headroom applied. The example I used this is was for hiding a subnavigation when the headroom was unpinned.
I also added in events, although there is probably a cleaner way to do this. this should fix #105