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
Add ngeo popover component #927
Add ngeo popover component #927
Conversation
1dbe702
to
aae5c06
Compare
ngeo.popoverDirective = function() { | ||
return { | ||
restrict: 'A', | ||
scope: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scope should not be isolate, otherwise we can't manage inner content of the popover from upper controllers.
Please try in your example to generate inner content of your popover from mainController model. |
scope: {}, | ||
link: function(scope, elem, attrs, controllers, transclude) { | ||
var ngeoPopoverCtrl = controllers[0]; | ||
ngeoPopoverCtrl.bodyElm = transclude(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try without transclude and just set ngeoPopoverCtrl.bodyElm
from element first child.
Translude is actually used for something specfic that is not your usecase.
I wonder if the transclude function doesn't ensure the content is compiled though.
To test.
The layertree will change a lot so the popover will be generated and destroyed, be sure you clean everything well when they are destroyed. |
Good work, I'v made some comments though. In the end, i think that one directive should have been enough for the whole thing, your approach is good but might introduce useless complexity. |
a3fb6e5
to
790a748
Compare
@fgravin following your advices, I pushed a new version. |
Looks good thanks @olivierSemet. |
content: ngeoPopoverCtrl.bodyElm | ||
}); | ||
|
||
scope.$on('$destroy', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to check it's needed (wait to integrate it in desktop app for that).
The element will be removed anyway, i hope jquery unregister all events when removing an element.
790a748
to
b4e8d51
Compare
link : function(scope, elem, attrs, controller) { | ||
var ngeoPopoverCtrl = controller; | ||
|
||
ngeoPopoverCtrl.anchorElm .on('hidden.bs.popover', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: space in front of .on
3b46a82
to
afb387c
Compare
8b159cc
to
9662e0b
Compare
2986439
to
43b2905
Compare
Good work. |
PR for the new ngeo component popover. The first goal of this component is to display actions capabilities for groups of layers or individual layers into the layertree but there is no limitation for other use at the moment.
Behavior of the component:
Check the example on my GH pages here