Hi i am developing SPA in angularjs. On successful user login i am setting one drop-down in the upper right corner. whenever we click drop-down will expand. I want to close that drop-down whenever user clicks anywhere in the page.
Below is my code to generate dropdown.
var id = document.getElementById('ProfileDropdown');
id.innerHTML = $scope.ProfileDropdown = ' <div data-drop-down>' + ' <ul>' +
'<li ><a ui-sref="Dashboard.Userprofile">User Profile</a></li>' +
'<li><a ui-sref="Dashboard.changepassword">Change Password</a></li>' +
'<li><a ui-sref="Dashboard.LeaseListings">Lease Request</a></li>' +
'<li><a ui-sref="#">Service Request</a></li>' +
'<li><a ui-sref="Dashboard.NewServiceRequest">New Service Request</a></li>' +
' <li ng-click="logout()">Logout</li>' +
'</ul>' + '</div>';
$compile(id)($scope);
I am struggling in finding out what should be done in order to close the drop down when user clicks elsewhere in page ?
This is SPA so i have one html page. In the rest i am using ui-routing to dynamically append contents.
May i get some help to fix this?
Any help would be appreciated !
Thank you.