npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng-qtip2

v1.3.3

Published

qTip 2 wrapper directive for AngularJS.

Downloads

501

Readme

ng-qtip2

qTip 2 directive for AngularJS.

Features

  • Two way bind support for content and title
  • Remote template file support
  • Customizable delay, trigger types, position, CSS classes and tip position

How to use

Manually include

  1. Make sure the file is included in your HTML:
  2. Load the ngQtip2 module in your app.js's configuration

Using bower

  1. Install with bower

     bower install ng-qtip2
  2. Make sure the file is included in your HTML:

     <script type="text/javascript" src="bower_components/ng-qtip2/ng-qtip2.js"></script>

Overriding default options

You may override any options for qTip tips globally in your module.
Do this by injecting qtipDefaultsProvider inside your app's config stage, and using the setDefaults method.
Example config stage:

angular.module('myApp', ['ngQtip2']).config(function(qtipDefaultsProvider) {
  qtipDefaultsProvider.setDefaults({
    position: {
      adjust: {
        x: 10,
        y: 20
      }
    }
  });
});

Available options

Interpolated means you can assign expressions inside using {{expression}} format to create dynamic content. Non-interpolated are immediately evaluated as they are. For example, qtip-visible expects a boolean condition expression inside (e.g. qtip-visible="title.length > 0" or qtip-visible="true").

| Option | Type | Description | |---|---|---| | qtip | [required] [interpolated] [string] | The qTip content. This can be left blank and overridden with other properties such as qtip-content, qtip-title, qtip-selector, and qtip-template. | | qtip-content | [optional] [interpolated] [string] | The qTip content. Overrides qtip. | | qtip-title | [optional] [interpolated] [string] | When specified, puts the value in qTip's built-in title option. | | qtip-visible | [optional] [boolean] [default=false] | Whether the qTip is visible immediately. | | qtip-disable | [optional] [boolean] [default=false] | Whether the qTip is disabled completely. Useful with ng-repeat and conditions inside the repeater, for example. | | qtip-fixed | [optional] [boolean] [default=true] | Whether the qTip sticks around after the mouse leaves it (up until a certain qtip-delay is reached) | | qtip-delay | [optional] [string|int] [default=100] | How long to wait before the qTip disappears after it becomes inactive when the mouseleave hide event is used (i.e, by default), in ms. | | qtip-adjust-x | [optional] [int] [default=0] | Position the qTip more to the left or right, relatively, in pixels. Use a negative value to move it left. | | qtip-adjust-y | [optional] [int] [default=0] | Position the qTip more to the top or bottom, relatively, in pixels. Use a negative value to move it up. | | qtip-show-effect | [optional] [boolean] [default=true] | If false, will disable animating the showing effect of qTip (this is useful when the dynamic positioning shows a flicker and animates the qTip from the side of the element or screen before positioning it correctly). | | qtip-hide-effect | [optional] [boolean] [default=true] | If false, will disable animating the hiding effect of qTip (this is useful when the dynamic positioning shows a flicker and animates the qTip from the side of the element or screen before positioning it correctly). | | qtip-modal-style | [optional] [object] [default={}] | Set inline style for the qTip. This should be a JS object that contains the JS-esque style properties (such as maxHeight: '100vh') | | qtip-tip-style | [optional] [object] [default={}] | Set inline style for the qTip's tip. This should be a JS object that contains the JS-esque style properties (such as maxHeight: '100vh'), and may also contain tip specific implementations (such as mimic, and corner). | | qtip-class | [optional] [string] [default=''] | Classes to use for the qTip, you can use these to style the qTip easier with CSS. | | qtip-selector | [optional] [string] [interpolated] | CSS selector for element to use. When specified, the element found using the selector and jQuery will override any other content specified. | | qtip-template | [optional] [string] [interpolated] | Remote template to use for qTip. When specified, the template will be used for the qTip content and will override any other content specified. Use in conjuction with qtip-template-object | | qtip-template-object | [optional] [anyObject] | Will assign a model to the qTip template for use inside the template's content. You can reference this using {{object}} inside the template. | | qtip-event | [optional] [string] [interpolated] [default=mouseover] | What event triggers the qTip to show up. | | qtip-event-out | [optional] [string] [interpolated] [default=mouseout] | What event triggers the qTip to hide after being shown. | | qtip-show | [optional] [object] | Object for the qtip 'show' option (see qTip docs). Will override qtip-event | | qtip-hide | [optional] [object] | Object for the qtip 'hide' option (see qTip docs). Will override qtip-event-out | | qtip-my | [optional] [string] [interpolated] [default=bottom center] | qTip bubble tip position relative to the qTip. "Put my tip at the qTip's..." | | qtip-at | [optional] [string] [interpolated] [default=top center] | qTip bubble tip position relative to the qTip. "Put my tip at the qTip's..." | | qtip-persistent | [optional] [boolean] [default=true] | If false, qTip will be re-rendered next time it is open. | | qtip-options | [optional] [object] | Object for the entire qtip initializer. This will merge itself into the other options specified in this table, overriding any existing keys. This is to explicitly override any options that are not handled the way you expect within these options, or to use options that are not yet implemented. | | qtip-api | [optional] [object] | Pass an empty reference object to this attribute to get back an "api" object (see below for api documentation) |

API Object

access the api by adding a scope object to qtip-api

<span qtip="Hi!" qtip-api="tip"></span>

and then access it in your code:

$scope.tip.api().get("position.my")

Because of the way qtip2 works, the api won't be available until you first render it. This means that it won't be ready until the user showed it (hovered on the associated directive) or you've passed to the options {prerender: true} which will force qtip2 to render the qtip on page load.

the qtip-api object has 3 methods:

  • isReady()

    Returns true/false because of the way qtip2 works, the api won't be available until you first render it. isReady() will tell you if the api object is ready for use

  • api()

    Returns a qtip2 api object for a full documentation about the api object, see: http://qtip2.com/api

  • apiPromise()

    Returns a $q promise holding the api object upon resolve example:

    $scope.tip.apiPromise().then(function(api) {
      console.log(api.get("content"));
    });

Examples

1. Regular qTip

<span qtip="Hi there, {{name}}!">{{name}}</span>

2. Immediately visible qTip

<span qtip="Woah!" qtip-visible="true">Keanu</span>

3. qTip from template, with multiple objects

<span qtip qtip-template="my_remote_template.html"
      qtip-template-object="{person: myPerson, callback: myCallback}">
    {{person.name}}
</span>
my_remote_template.html
<span ng-click="object.callback(person)">
    Hi {{object.person.name}}, you are {{object.person.age | pluralize:'year'}} old!
</span>

4. Dynamic qTip position

<ul>
    <li ng-repeat="person in people track by $index"
        qtip="{{$index}}"
        qtip-my="{{getQtipMy($index)}}"
        qtip-at="top {{$index > 15 ? 'center' : 'bottom'}}">
        {{person.name}}
    </li>
</ul>

Contributing

  1. Fork this repository
  2. Make the desired changes
  3. Test your implementations, and that nothing was broken
  4. To auto-compile JS from Coffee, copy pre-commit.hook to .git/hooks
  5. Commit & Push to your fork (auto-compile should do its magic during commit)
  6. Create a pull request