Bugs popover
This commit is contained in:
parent
c2530acafd
commit
1f1fcce5a8
|
@ -2,7 +2,7 @@
|
|||
<vn-textfield vn-one label="Search" model="$ctrl.search"></vn-textfield>
|
||||
<vn-icon icon="keyboard_arrow_down" ng-click="searchbar.onClick($event)" style="cursor: pointer;"></vn-icon>
|
||||
<vn-icon-button icon="search"></vn-icon-button>
|
||||
<vn-popover>
|
||||
<vn-popover id="popover">
|
||||
<vn-search-panel></vn-search-panel>
|
||||
</vn-popover>
|
||||
</vn-horizontal>
|
|
@ -14,9 +14,20 @@ export function directive(resolver) {
|
|||
return resolver.getTemplate(_NAME, attrs);
|
||||
},
|
||||
controller: function($element) {
|
||||
var self = this;
|
||||
var doc = angular.element(document);
|
||||
function docMouseDownHandler (event) {
|
||||
if (event != self.lastEvent)
|
||||
self.hide();
|
||||
}
|
||||
this.onMouseDown = function(event) {
|
||||
this.lastEvent = event;
|
||||
};
|
||||
this.hide = function ()
|
||||
{
|
||||
$element[0].style.display = 'none';
|
||||
doc.off('mousedown', docMouseDownHandler);
|
||||
}
|
||||
this.show = function(parent) {
|
||||
var node = $element[0];
|
||||
var style = node.style;
|
||||
|
@ -60,16 +71,7 @@ export function directive(resolver) {
|
|||
}
|
||||
|
||||
style.display = 'block';
|
||||
|
||||
var self = this;
|
||||
var doc = angular.element(document);
|
||||
var clickHandler = function(event) {
|
||||
if (event != self.lastEvent) {
|
||||
style.display = 'none';
|
||||
doc.off('mousedown', clickHandler);
|
||||
}
|
||||
}
|
||||
doc.on('mousedown', clickHandler);
|
||||
doc.on('mousedown', docMouseDownHandler);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue