Solved

angular.module tooltip, how do I hide it from a div element click?

Posted on 2014-11-26
1
332 Views
Last Modified: 2014-12-04
if i have a inner div inside of the code below that when clicked how can i hide the element?  
angular.module("template/tooltip/tooltip-html-unsafe-popup.html", []).run(["$templateCache", function($templateCache) {
  $templateCache.put("template/tooltip/tooltip-html-unsafe-popup.html",
    "<div class=\"tooltip {{placement}}\" ng-class=\"{ in: isOpen(), fade: animation() }\">\n" +
    "  <div class=\"tooltip-arrow\"></div>\n" +
    "  <div class=\"tooltip-inner\" ng-bind-html-unsafe=\"getToolTipHtml()\"></div>\n" +
    "</div>\n" +
    "");
}]);
0
Comment
Question by:cbrune
1 Comment
 
LVL 30

Accepted Solution

by:
Alexandre Simões earned 500 total points
Comment Utility
Why don't you just do a proper directive and have full control over both tooltip and attached element?

For instance, you can create your own 'title' directive that attaches to all elements with the title attribute and "overrides" the default browser behavior.
If your tooltips are more complex with html inside other than just text, the directive can detect actions in both tooltip and attached html element.

I can also see there a pack of functions like, isOpen(), animation(), getToolTipHtml()... where are you declaring them? In some sort of MainController outside the module context?

Again, with a directive you'll be able to encapsulate all the logic in one single place, passing in the information instead of expecting things to exist exist outside.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now