简体   繁体   中英

Hiding uib popover on button click not working

Anchor tag on which html popover

<a popover-trigger="outsideClick" popover-placement="top" ng-click="sendMessagePopover.open()" type="button" popover-append-to-body="true" popover-is-open="sendMessagePopover.isOpen" uib-popover-template="sendMessagePopover.templateUrl">Menu</a>

ng-Template that contains close button on which click popover should close.

<script  type="text/ng-template" id="message-to-pnd-popover.tpl.html">
<div class="well">
    <form name="myForm"  ng-controller="myController">
       <div class="form-group">
            <span class="btn btn-primary" ng-click="sendMessagePopover.close()">Close</span>
        </div>
    </form>
</div></script>

angular controller code

angular.controller('myController',['$scope',function($scope){
$scope.sendMessagePopover = {
            on: false,
            isOpen: false,
            templateUrl: 'message-to-pnd-popover.tpl.html',
            open: function() {
                $scope.sendMessagePopover.isOpen = true;
            },
            close: function() {
                $scope.sendMessagePopover.isOpen = false;
            }
        }]);

When we click on anchor link it popover the template and when we click outside anywhere it close the popover.

I want to close the popover when user click on close button that i put in template. But it's not working.

I am new this technology, help out with proper example.

The popover-trigger="outsideClick" is designed to close the popover when clicking anywhere outside of the popover content. If you want to manage opening and closing the popover using the is-open attribute, use popover-trigger="none".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM