Code Monkey home page Code Monkey logo

ionic-tooltips's Introduction

Ionic Tooltips

npm npm npm

Tooltips module for apps built with Ionic Framework.

Compatibility

Versions above 4.0.0 support Ionic 4 only. For older versions please use the ionic3 branch.

Demo

Below is a gif showing the module in action, you can also clone the example project here: https://github.com/zyra/ionic-tooltips-example

Ionic Tooltips Demo

Examples

The module can be used to display tooltips for any element in your app. It also provides a special treatment for buttons in the header navigation (inspired by Google's apps).

Here's a quick example to show a tooltip below a button:

<!-- positionV specifies where the tooltip should be displayed vertically, can be either top or bottom -->
<!-- arrow tells the tooltip directive to show an arrow above the tooltip box -->
<button ion-button tooltip="I'm a tooltip below a button" positionV="bottom" arrow>
  Press me to see a tooltip
</button>

And here's another example to show a tooltip below a nav button:

<ion-header>
  <ion-navbar>
    <ion-title>Page title</ion-title>
    <ion-buttons end>
      <!-- navTooltip tells the tooltip directive that this is a nav button -->
      <ion-button icon-only tooltip="Call" navTooltip>
        <ion-icon name="call"></ion-icon>
      </ion-button>
    </ion-buttons>
  </ion-navbar>
</ion-header>

Installation

  1. Install this module by running the following command:
npm i ionic-tooltips@beta
  1. Import TooltipsModule in your @NgModule. If you are using lazy module loading, then you need to import it in the modules where it's used.
import { TooltipsModule } from 'ionic-tooltips';

@NgModule({
   ...
   imports: [
      ...
      TooltipsModule.forRoot()
   ]
})
export class MyModule { ... }
  1. Import BrowserAnimationsModule in your app's main @NgModule.
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

@NgModule({
  ...
  imports: [
    ...
    BrowserAnimationsModule
  ]
})

Now you're ready to use this module. See information below for usage.

Usage

The tooltip directive takes a string, which will be used as the tooltip text. To use HTML in your tooltip, you need to pass the content through the [tooltipHtml] directive documented below. When using the tooltip directive, you can also use the following inputs:

tooltipHtml

(string) specifies HTML to use inside the tooltip. This will override any value you passed with the [tooltip] directive (if any was provided).

navTooltip

(boolean) add this attribute or set it's value to true to specify that the tooltip belongs to a nav button. Defaults to false.

positionV

(string) specifies the vertical position of the tooltip. Can be either 'top' or 'bottom'.

positionH

(string) specifies the horizontal position of the tooltip. Can be either 'right' or 'left'.

event

(string) the event to show the tooltip on. Can be either 'hover', 'click' or 'press'. Defaults to 'hover' on desktop, 'press' on mobile.
Note: 'hover' only works on desktop.

desktopEvent

(string) the event to show the tooltip on when displayed on a desktop . Can be either 'hover', 'click' or 'press'. Defaults to 'hover'.
Note: This only works when the event attribute is omitted.

mobileEvent

(string) the event to show the tooltip on when displayed on a mobile. Can be either 'click' or 'press'. Defaults to 'press'.
Note: This only works when the event attribute is omitted.

arrow

(boolean) add this attribute or set it's value to true to show an arrow attached to the tooltip. Defaults to false.

duration

(number) number of milliseconds to show the tooltip for. Defaults to 3000.

active

(boolean) add this attribute or set it's value to true to display the tooltip. Defaults to false.

topOffset

(number) add this attribute to offset the vertical position of the tooltip. Defaults to 0.

leftOffset

(number) add this attribute to offset the horizontal position of the tooltip. Defaults to 0.

hideOthers

(boolean) add this attribute to set weather to hide other visible tooltips. Defaults to false.



Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Contribution

  • Having an issue? or looking for support? Open an issue and we will get you the help you need.
  • Got a new feature or a bug fix? Fork the repository, make your changes, and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Support this project

If you find this project useful, please star the repository to let people know that it's reliable. Also, share it with friends and colleagues that might find this useful as well. Thank you 😄

ionic-tooltips's People

Contributors

danielsogl avatar doug-a-brunner avatar ihadeed avatar jwelmac avatar madobaker avatar willyboy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ionic-tooltips's Issues

NOT innerHTML

Hello,

Hello,

The plugin is cool, unfortunately there are no properties innerHTML, and in the content if we put tags like </ br> and well it is not interpret as html tag.
Can you help me please

thank you

Tooltip does not disappear when clicking on the element containing the "hover" event for display

I have the tooltip placed on various button elements using the hover event. They are displayed correctly and if I mouse-out they disappear. But if I click on that button, the tooltip does NOT disappear. Is this a known issue? Is there a solution? Help? Do I need to manually destroy the tooltip in my click event?

HTML Example:


<button id="buttonID" tooltip="Some Text" navTooltip arrow event="hover" ion-button icon-only (click)="someEvent()">



I do have everything in my app.module that is needed.

Example:
import { TooltipsModule } from 'ionic-tooltips';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

@NgModule({
imports: [
TooltipsModule,
BrowserAnimationsModule
],

Error when pressing an ion-icons with the property tooltips

I have a box that shows information with icons and numbers. When pressing any icon I want to show a legend that indicates that it represents that icon and associated value ... Everything works perfect, when pressing an icon the legend is displayed as expected and it respects the configurations of the established tooltips, but with each click returns an error by console ...

The error is as follows:
"TypeError: undefined is not a function
    at WebAnimationsPlayer.play (file: ///android_asset/www/build/vendor.js: 137345: 24)
    at TransitionAnimationPlayer.play (file: ///android_asset/www/build/vendor.js: 136663: 48)
    at file: ///android_asset/www/build/vendor.js: 136293: 20
    at Array.forEach (native)
    at TransitionAnimationEngine._flushAnimations (file: ///android_asset/www/build/vendor.js: 136286: 21)
    at TransitionAnimationEngine.flush (file: ///android_asset/www/build/vendor.js: 135945: 32)
    at InjectableAnimationEngine.AnimationEngine.flush (file: ///android_asset/www/build/vendor.js: 137150: 32)
    at file: ///android_asset/www/build/vendor.js: 130958: 30
    at t.invoke (file: ///android_asset/www/build/polyfills.js: 3: 14976)
    at r.run (file: ///android_asset/www/build/polyfills.js: 3: 10143) "

A segment of my HTML:

  <div padding class = "board-content" * ngIf = "service! = null">
    
    


      


        <ion-icon
          class = "element-style"
          name = "man"
          tooltip = "My Tooltip"
          positionV = "bottom"
          arrow = "true"
          duration = 5000
          event = "click">
        </ ion-icon>
      </ p>
      

{{service.currentStatus.count}} </ p>
      

| </ p>
    </ div>
  </ div>
</ ion-content>

I tried putting the tooltip with [] but I got the same result ...
I have a lazyLoad implemented and I load the TooltipsModule in the same module.
I have the BrowserAnimationsModule in the App.module imported as well.

I guess that since this is working anyway, the TooltipsModule would not be the problem, it might be that I have an error in my html or a problem in loading the BrowserAnimationsModule ...

My dependencies in package.json are:
 "dependencies": {
    "@ angular / animations": "5.0.3",
    "@ angular / common": "^ 5.0.3",
    "@ angular / compiler": "5.0.3",
    "@ angular / compiler-cli": "5.0.3",
    "@ angular / core": "5.0.3",
    "@ angular / forms": "5.0.3",
    "@ angular / http": "5.0.3",
    "@ angular / platform-browser": "5.0.3",
    "@ angular / platform-browser-dynamic": "5.0.3",
    "@ ionic-native / core": "^ 4.5.2",
    "@ ionic-native / native-storage": "^ 4.5.2",
    "@ ionic-native / splash-screen": "^ 4.4.0",
    "@ ionic-native / status-bar": "4.4.0",
    "@ ionic / storage": "^ 2.1.3",
    "@ ngx-translate / core": "^ 9.0.2",
    "@ ngx-translate / http-loader": "^ 2.0.1",
    "chart.js": "^ 2.7.1",
    "cordova-android": "6.3.0",
    "cordova-plugin-device": "^ 1.1.7",
    "cordova-plugin-ionic-webview": "^ 1.1.16",
    "cordova-plugin-nativestorage": "^ 2.2.2",
    "cordova-plugin-splashscreen": "^ 4.1.0",
    "cordova-plugin-statusbar": "^ 2.4.1",
    "cordova-plugin-whitelist": "^ 1.3.3",
    "gradle": "^ 1.0.9",
    "ionic-angular": "3.9.2",
    "ionic-plugin-keyboard": "^ 2.2.1",
    "ionic-tooltips": "^ 2.0.1",
    "ionicons": "3.0.0",
    "rxjs": "5.5.2",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18"

Thank you very much now and apologies for my English, which is very bad: P

specify the arrow's position

if it can specify the arrow's position according to the position where user clicks rather than always left:10px, it'd be better

[active] in Ionic 4

is possible to control the tooltip ONLY via code?
the tooltip is still active on hover - desktop - Ionic 4 - how to disable that

<ion-item tooltip="I'm a tooltip" [active]="activeTooltip" arrow >

activeTooltip: boolean = false;

ionViewWillEnter() { this.activeTooltip = false; }

zzzzzzz

Font not working

here is the output on the console:

downloadable font: download failed (font-family: "Roboto" style:normal weight:normal stretch:normal src index:2): status=2147746065 source: http://localhost:8100/assets/fonts/roboto-regular.woff2  main.css:3769:12
downloadable font: download failed (font-family: "Roboto" style:normal weight:500 stretch:normal src index:2): status=2147746065 source: http://localhost:8100/assets/fonts/roboto-medium.woff2  main.css:3776:12
Dev server logger closed  ion-dev.js:120:9
downloadable font: download failed (font-family: "Roboto" style:normal weight:normal stretch:normal src index:3): status=2152398850 source: http://localhost:8100/assets/fonts/roboto-regular.woff  main.css:3769:12
downloadable font: download failed (font-family: "Roboto" style:normal weight:500 stretch:normal src index:3): status=2152398850 source: http://localhost:8100/assets/fonts/roboto-medium.woff  main.css:3776:12
GET 
http://localhost:8100/assets/fonts/roboto-regular.ttf [HTTP/1.1 404 Not Found 15ms]
GET 
http://localhost:8100/assets/fonts/roboto-medium.ttf [HTTP/1.1 404 Not Found 15ms]
downloadable font: download failed (font-family: "Roboto" style:normal weight:normal stretch:normal src index:4): status=2147746065 source: http://localhost:8100/assets/fonts/roboto-regular.ttf  main.css:3769:12
downloadable font: download failed (font-family: "Roboto" style:normal weight:500 stretch:normal src index:4): status=2147746065 source: http://localhost:8100/assets/fonts/roboto-medium.ttf  main.css:3776:12
Unhandled Promise rejection: Template parse errors:
Parser Error: Unexpected token 'tooltip' at column 6 in [ssss tooltip] in ng:///AppModule/PrefaceComponent.html@28:56 ("
        <p class="indented">

            Our work in this book, Mohammad<sup><button [ERROR ->][tooltip]="ssss tooltip" positionV="bottom" arrow>1</button></sup>            in the Bible, was just "): ng:///AppModule/PrefaceComponent.html@28:56
Parser Error: Unexpected token 'tooltip' at column 6 in [ssss tooltip] in ng:///AppModule/PrefaceComponent.html@28:56 ("
        <p class="indented">

Hover default to press on phone?

Currently designing an app for a desktop but it will need to be mobile in the near future. I'm wondering if the "hover" event defaults to "press" once it detects that it's being used on a mobile device? Thanks!

Cannot find module '@ionic/angular'.

Describe the bug

Using Ionic 3.9.3 - I cannot build the project after installing 4.0.0-beta.0

Cannot find module '@ionic/angular'.

Additional context

Ionic:
ionic (Ionic CLI) : 4.11.0
Ionic Framework : ionic-angular 3.9.3
@ionic/app-scripts : 3.2.1

Cordova:
cordova (Cordova CLI) : 8.1.2 ([email protected])
Cordova Platforms : android 7.1.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 6 other plugins)

System:
NodeJS : v10.15.1
npm : 6.0.0
OS : Windows 10

Doesn't work with Ionic 4

Multiple errors thrown in console. Updating paths from 'ionic-angular' to '@ionic/angular' (as per latest Ionic) causes the following error:

ERROR TypeError: Cannot read property 'createComponent' of undefined
    at Tooltip.push../node_modules/ionic-tooltips/dist/tooltip.directive.js.Tooltip._createTooltipComponent (tooltip.directive.js:173)
    at Tooltip.push../node_modules/ionic-tooltips/dist/tooltip.directive.js.Tooltip.showTooltip (tooltip.directive.js:121)
    at Tooltip.set [as active] (tooltip.directive.js:46)
    at Tooltip.push../node_modules/ionic-tooltips/dist/tooltip.directive.js.Tooltip.onMouseEnter (tooltip.directive.js:162)
    at Object.eval [as handleEvent] (PtRegisterFormComponent.html:37)
    at handleEvent (core.js:23009)
    at callWithDebugContext (core.js:24079)
    at Object.debugHandleEvent [as handleEvent] (core.js:23806)
    at dispatchEvent (core.js:20458)
    at core.js:20905

We could really do with a GOOD tooltip component for Ionic and angular. The current offerings are sub-optimal:

Angular Material: severely limited because google's tyrannical guidelines
Bootstrap: problematic, incompatible with ionic
Others: too light to be useful (balloon), or require bulky setup (materialize), or whatever

Not working with shared module

I'm using your tooltip module on a lazy loaded project.

I have a shared module that I import in my lazy-loaded page si I don't have to import TooltipsModule, TranslateModule and more on every page... But it's not working.

When I use TooltipsModule straight in my page module, it's working.

Any ideas? Thanks!

Property 'forRoot' does not exist on type 'typeof TooltipsModule'.ts in ionic 3

Describe the bug
when i tried to import in app.module.ts
TooltipsModule.forRoot()
it says forRoot does not exist.

To Reproduce
just installed in ionic 3 and importing in app.module.ts

Expected behavior
there should be no error

Screenshots
Screenshot from 2019-07-13 09-33-14

.

Desktop (please complete the following information):

  • Browser chrome
  • Version : ionic-tooltips: ^2.1.1
  • Angular Version: angular - ^1.7.8 , ionic-angular: "^3.9.2"

Debounce

Anyway to put a debounce feature?

the tooltip only apears if the user hover the mouse more than X miliseconds...

thankss

Only for buttons ???

Hi,

Is this working on buttons?

I would use it to show errors in input forms ..

Trigger from controller

Very nice module :)

Would be awesome to have the possibility to trigger tooltips programmatically, for showing tips the first time a user open a page or other, and dismissing them by clicking on them !

Doesn't seem to work with Ionic 3.7.0

Hi, I cloned your example repo - worked fine, but when I updated libs to Ionic 3.7.0 there were several errors around AnimationBuilder and related classes being absent.

note: after updating to Ionic 3.7.0, I imported BrowserAnimationsModule in your app.module.ts like so:


import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; // <--THIS
import { TooltipsModule } from '../ionic-tooltips/src';
 imports: [
    BrowserModule,
    BrowserAnimationsModule, // <--THIS
    IonicModule.forRoot(MyApp),
    TooltipsModule
  ],

ionic info:

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.12.0
    ionic (Ionic CLI) : 3.12.0

local packages:

    @ionic/app-scripts : 3.0.0
    Ionic Framework    : ionic-angular 3.7.0

System:

    Node : v8.6.0
    npm  : 5.3.0 
    OS   : macOS Sierra

Misc:

    backend : legacy

'active' attribute behavior isn't predictable

I'm trying to display my tooltips programatically. Preferably on page load, I'd want relavant tooltips to display themselves for 5 seconds.

I did something like this:


show_tooltips: Boolean = false;

IonPageDidLoad = () => {
    console.log("Page loaded");

    this.show_tooltips = true;

    setTimeout(() => {
        console.log("Hiding tooltips");

        this.show_tooltips = false;
    }, 5000);
}

In the DOM I set the active my attribute on my button like this: active="{{ show_tooltips }}".

When the page loads for a split second I can see the tooltips (maybe when the show_tooltips variable is created and then set to false), but once the IonPageDidLoad function runs and sets show_tooltips to true, nothing happens. Then 5 seconds later when show_tooltips is set to false, the tooltips display.

I expected this to be the other way around. I went ahead and switched the assignments around, thinking maybe the documentation was just incorrect, but nothing happened this time around either. I tried doing this, before setting the timeout:

    this.show_tooltips = false;
    this.show_tooltips = true;

to see if maybe they need to be 'hidden' before being 'revealed', but that didn't work either. Can you give me some clarity? Am I doing something wrong? Is this behavior expected? I was really hoping to use this in a tutorial inside my application, but being unable to programatically show and hide the tooltips is a dealbreaker for me.

Allow word wrap for longer messages

when using this module in a browser the longer messages will hit the border of screen and instead of wrapping onto a new line with a larger tooltip box they will instead be "pushed" away from that screen edge resulting in tooltips that start in odd positions on top of the element they are attached to.

Add the ability to override the built in functionality of having the tooltip on one line.

I fixed this for my own use by forking and removing the section of code that causes this in the directive. Perhaps adding another boolean to control this behave would help out other users?
Something like this in the tooltip.directive.ts:

  set allowTextWrap(val: boolean){
    this._wrapText = typeof val !== 'boolean' || val !== false;
  }

  get allowTextWrap(): boolean{
    return this._wrapText;
  }

private _wrapText: boolean = false;

if(this.allowTextWrap){
      if (
        positionLeft + tooltipNativeElement.offsetWidth + spacing >
        this.platform.width()
      ) {
        positionLeft =
          this.platform.width() - tooltipNativeElement.offsetWidth - spacing;
      } else if (positionLeft + tooltipNativeElement.offsetWidth - spacing < 0) {
        positionLeft = spacing;
      }
    }

This solves my problem of the horizontal word wrapping (only tested on browser, not mobile).

Use HTML in tooltips

I would like to add some markup (at least some <br />), but HTML is escaped. Any ideas on how I could achieve that?

Thanks!

ERROR "No provider for TooltipController"

Describe the bug
When the app load a page where a tooltip directive is used, the following error happens:

Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[Tooltip -> TooltipController]: StaticInjectorError(Platform: core)[Tooltip -> TooltipController]: NullInjectorError: No provider for TooltipController! 

I suspect I'm doing something wrong but I cannot identify what it is. Having a look at the example project didn't help me to sort out this.

Thanks for help!

To Reproduce

  1. install the directive (I'm using v3 because of Ionic v3)
    npm i ionic-tooltips@3 --save
  2. add module to app.module.ts
import { TooltipsModule } from 'ionic-tooltips';
...
  imports: [
   ...
    IonicModule.forRoot(MyApp),
    TooltipsModule,
    ...
  1. add a tooltip directive on any html element of the page:
...
<img tooltip='sample text' [event]='hover'/>
...

Expected behavior
When the app is run and the page is displayed, the text "sample text" is displayed if I move the mouse cursor on the image

Desktop (please complete the following information):

  • OS: macOS 10.12.4
  • Browser Safari
  • Version 12.0,.3
  • Angular Version: 5.2.11

I am having an issue with installing this..

Error 1:

npm i --save --save-exact @angular/[email protected]
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

Error 2:

npm i --save --save-exact @angular/[email protected]
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})


My Ionic Info is below

cli packages: (C:\Users\ramesh\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.0.1
    Node              : v8.9.4
    npm               : 5.6.0
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME : C:\Code\Android\adt-bundle-windows-x86_64-20140702\sdk

Misc:

    backend : pro

/ionic-tooltips/dist/index.js not found

Describe the bug
I get the following error after installing the tooltip and setting up animations and tooltip in my app.module.ts. I've installed the beta version.

./node_modules/ionic-tooltips/dist/index.js
Module build failed: Error: ENOENT: no such file or directory

ionic info

Ionic:

   ionic (Ionic CLI)             : 4.10.2 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.1.2
   @angular-devkit/build-angular : 0.13.7
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.3.7
   @ionic/angular-toolkit        : 1.4.1

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 6 other plugins)

System:

   ios-deploy : 1.9.4
   ios-sim    : ios-sim/9.0.0-dev.1 darwin-x64 node-v10.15.1
   NodeJS     : v10.15.1 (/usr/local/bin/node)
   npm        : 6.4.1
   OS         : macOS Mojave
   Xcode      : Xcode 10.2.1 Build version 10E1001

Lazy Load Browser Module

Uncaught (in promise): Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead. Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead. at new BrowserModule (http://localhost:8100/build/main.js:48813:19) at BeerPageModuleInjector.createInternal (ng:///BeerPageModule/module.ngfactory.js:195:28) at BeerPageModuleInjector.NgModuleInjector.create (http://localhost:8100/build/main.js:3919:76) at NgModuleFactory.create (http://localhost:8100/build/main.js:3892:18) at http://localhost:8100/build/main.js:84454:53 at t.invoke (http://localhost:8100/build/polyfills.js:3:8971) at Object.onInvoke (http://localhost:8100/build/main.js:4510:37) at t.invoke (http://localhost:8100/build/polyfills.js:3:8911) at r.run (http://localhost:8100/build/polyfills.js:3:4140) at http://localhost:8100/build/polyfills.js:3:13731 at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9655) at Object.onInvokeTask (http://localhost:8100/build/main.js:4501:37) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9576) at r.runTask (http://localhost:8100/build/polyfills.js:3:4831) at o (http://localhost:8100/build/polyfills.js:3:1891) at

Cannot read property 'destroy' of undefined

Ionic version: (check one with "x")
(For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[ x] 3.x
[ ] 4.x

I'm submitting a ... (check one with "x")
[x ] bug report
[ ] feature request

Browser : Chrome v.61.0.3163.100

Steps to reproduce:

  • list item with tooltip
  • quick mouse over on a lot of randoms item
  • there's error below
    ERROR TypeError: Cannot read property 'destroy' of undefined
    at tooltip.directive.js:174
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (core.es5.js:4140)
    at t.invokeTask (polyfills.js:3)
    at r.runTask (polyfills.js:3)
    at invoke (polyfills.js:3)
    at n (polyfills.js:2)

Error report on console

Describe the bug
Using Ionic v4.12
On the console I get a message: The "press" event cannot be bound because Hammer.JS is not loaded and no custom loader has been specified.
As far as I could tell it comes from tooltip.directive.ts on the @HostListener('press') decorative.

To Reproduce
Also I have to mention that I do not use your component as is because I had to provide support to multi lingual hints so I changed the trigger() function to get the hint text from API and on the provider observable subscription I called showTooltip() with the resulted text. I do not believe this is the cause of the problem though.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
image

Desktop (please complete the following information):

  • OS: linux fedora 28
  • Browser chrome 73.0.3683.103 (Official Build) (64-bit) on Incognito window
  • Version Ionic v4.12
  • Angular Version: 7.2.2

Additional context
When I commented out the @HostListener('press') function I did not receive this error.

i found following error when using ionic tooltip

ionic-app-script task: "build"
[11:45:38] Error: ./node_modules/ionic-tooltips/dist/tooltips.module.ts Module not found: Error: Can't resolve
'@angular/platform-browser/animations' in 'D:\IONIC\reetzy\node_modules\ionic-tooltips\dist' resolve
'@angular/platform-browser/animations' in 'D:\IONIC\reetzy\node_modules\ionic-tooltips\dist' Parsed request
is a module using description file: D:\IONIC\reetzy\node_modules\ionic-tooltips\package.json (relative path:
./dist) Field 'browser' doesn't contain a valid alias configuration after using description file:
D:\IONIC\reetzy\node_modules\ionic-tooltips\package.json (relative path: ./dist) resolve as module looking
for modules in D:\IONIC\reetzy\node_modules using description file: D:\IONIC\reetzy\package.json (relative
path: ./node_modules) Field 'browser' doesn't contain a valid alias configuration after using description
file: D:\IONIC\reetzy\package.json (relative path: ./node_modules) using description file:
D:\IONIC\reetzy\node_modules@angular\platform-browser\package.json (relative path: ./animations) no
extension Field 'browser' doesn't contain a valid alias configuration
D:\IONIC\reetzy\node_modules@angular\platform-browser\animations doesn't exist .ts Field 'browser' doesn't
contain a valid alias configuration D:\IONIC\reetzy\node_modules@angular\platform-browser\animations.ts
doesn't exist .js Field 'browser' doesn't contain a valid alias configuration
D:\IONIC\reetzy\node_modules@angular\platform-browser\animations.js doesn't exist .json Field 'browser'
doesn't contain a valid alias configuration
D:\IONIC\reetzy\node_modules@angular\platform-browser\animations.json doesn't exist as directory
D:\IONIC\reetzy\node_modules@angular\platform-browser\animations doesn't exist
[D:\IONIC\reetzy\node_modules@angular\platform-browser\animations]
[D:\IONIC\reetzy\node_modules@angular\platform-browser\animations.ts]
[D:\IONIC\reetzy\node_modules@angular\platform-browser\animations.js]
[D:\IONIC\reetzy\node_modules@angular\platform-browser\animations.json]
[D:\IONIC\reetzy\node_modules@angular\platform-browser\animations] @
./node_modules/ionic-tooltips/dist/tooltips.module.ts 5:0-79 @ ./node_modules/ionic-tooltips/dist/index.js @
./src/app/app.module.ts @ ./src/app/main.ts
Error: ./node_modules/ionic-tooltips/dist/tooltips.module.ts

Possible memory leak causes tooltips to appear in corner without text.

I'm currently working on an Electron/Ionic desktop application, and I recently added this package to enable tooltips when a user hovers over a button. One of our users recently reported that the tooltip appeared in the top left corner of the window instead of above/below the button as expected. In addition, the tooltip was completely blank and did not contain the expected text. The issue is inconsistent, but is generally accompanied by the following error in the console.

(node:4208) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 GetAuthTokenError listeners added. Use emitter.setMaxListeners() to increase limit

I am using Angular 4.1.3, Ionic 3.4.2, Ionic-Angular 3.5.0, and ionic-tooltips 2.0.0.

accessibility of tooltip - WCAG 4.1.3

Users with disabilities have difficulties being aware of changes in the page, they will not read the tooltip as it is right now. The best way to improve this per WCAG criteria 4.1.3 is to add a role="status" to the tooltip-box.
It could be made as a new attribute if you don't always want to have the role.

How can I change tootip style ?

On IONIC 4, how can I change the tooltip style (background-color, padding, text style, etc...) ?
I've searched but I don't find anything...

Thanks.

UNMET PEER DEPENDENCY @angular/[email protected]

this error keeps poppin' whenever I try to install this plugin.

+-- @angular/[email protected]
`-- UNMET PEER DEPENDENCY @angular/[email protected]

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.

ionic version: 3.19.0
npm version: 3.10.10
angular-cli: 1.0.0-beta.28.3
node: 6.11.2
os: win32 x64
@angular/animations: 4.1.3
@angular/common: 5.0.3
@angular/compiler: 5.0.3
@angular/compiler-cli: 5.0.3
@angular/core: 5.0.3

Tooltip position is incorrect when using inside a scrolled ion-list

Describe the bug
If you place the tooltip on an element at the bottom of an ion-list the tool tip does not show in the correct position. Instead it shows further up the list.

To Reproduce
Create an ion-list with enough elements to allow scrolling
Place tooltip on element at end of list
Trigger element

Expected behavior
Element should appear next to the clicked element

Desktop (please complete the following information):

  • OS: Catalina
  • Browser: chrome
  • Version 78
  • Angular Version: 8

Getting error after implement this

I have tried this in ionic new project but I am getting below error.

Errror: Uncaught TypeError: Object prototype may only be an Object or null: undefined
at setPrototypeOf ()
at __extends (tslib.es6.js:22)
at animations.js:24
at Object. (animations.js:61)
at webpack_require (bootstrap 882e1c7eb5e447169b70:54)
at Object.219 (main.ts:5)
at webpack_require (bootstrap 882e1c7eb5e447169b70:54)
at Object.195 (main.js:78)
at webpack_require (bootstrap 882e1c7eb5e447169b70:54)
at webpackJsonpCallback (bootstrap 882e1c7eb5e447169b70:25)

Please give your help/suggestion for the same.

[Ionic v4)] Can’t bind to ‘ngIf’ since it isn’t a known property of ‘div’

I’m trying to use the module with Ionic v4. The module was installed with npm.

Creating a new blank project and following the installation steps I got some problems. First with some missing components that I was able to fix manually changing the imports of some files, just like in this question. I see that the module was updated to Ionic v4, but this imports are still linking with the ionic v3 structure, is this a currently problem or the npm package is outdated?

After that I got this other error:

ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'ngIf' since it isn't a known property of 'div'. ("
    <div [ERROR ->]*ngIf="tooltipHtml; else txt" [innerHTML]="tooltipHtml"></div>
    <ng-template #txt>{{ text }}</ng-t"): ng:///TooltipsModule/TooltipBox.html@1:9
Can't bind to 'ngIfElse' since it isn't a known property of 'div'. ("
    <div [ERROR ->]*ngIf="tooltipHtml; else txt" [innerHTML]="tooltipHtml"></div>
    <ng-template #txt>{{ text }}</ng-t"): ng:///TooltipsModule/TooltipBox.html@1:9
Property binding ngIf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
    [ERROR ->]<div *ngIf="tooltipHtml; else txt" [innerHTML]="tooltipHtml"></div>
    <ng-template #txt>{{ text }}<"): ng:///TooltipsModule/TooltipBox.html@1:4
Property binding ngIfElse not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
    [ERROR ->]<div *ngIf="tooltipHtml; else txt" [innerHTML]="tooltipHtml"></div>
    <ng-template #txt>{{ text }}<"): ng:///TooltipsModule/TooltipBox.html@1:4
Error: Template parse errors:
Can't bind to 'ngIf' since it isn't a known property of 'div'. ("
    <div [ERROR ->]*ngIf="tooltipHtml; else txt" [innerHTML]="tooltipHtml"></div>
    <ng-template #txt>{{ text }}</ng-t"): ng:///TooltipsModule/TooltipBox.html@1:9
Can't bind to 'ngIfElse' since it isn't a known property of 'div'. ("
    <div [ERROR ->]*ngIf="tooltipHtml; else txt" [innerHTML]="tooltipHtml"></div>
    <ng-template #txt>{{ text }}</ng-t"): ng:///TooltipsModule/TooltipBox.html@1:9
Property binding ngIf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
    [ERROR ->]<div *ngIf="tooltipHtml; else txt" [innerHTML]="tooltipHtml"></div>
    <ng-template #txt>{{ text }}<"): ng:///TooltipsModule/TooltipBox.html@1:4

After some searching I got some awnsers that converged to the same solution: Import Ionic CommonModule to the main Module. I did this, no success.

My home.page.html:

<ion-content>
  	<ion-button tooltip="I'm a tooltip below a button" positionV="bottom" arrow>
	   Press me to see a tooltip
	  </ion-button>
</ion-content>

home.module.ts:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IonicModule } from '@ionic/angular';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';

import { HomePage } from './home.page';

import { TooltipsModule } from 'ionic-tooltips';

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,
    RouterModule.forChild([
      {
        path: '',
        component: HomePage
      }
    ]),
    TooltipsModule.forRoot()
  ],
  declarations: [HomePage]
})
export class HomePageModule {}

app.module.ts (where I lastly tried to import CommonModule):

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
  imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, BrowserAnimationsModule],
  providers: [
    StatusBar,
    SplashScreen,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

If there is any missing info, please ask.

Warning on upgrading Ionic Angular version to 3.7

Hi,

Thanks for the plugin. Upgrading to latest ionic-angular (3.7.1) throws a peer dependencies warning. Looks like the plugin depends on Angular ~4.1.
Let me know if I can help you with a pull request.

Thanks

Tooltips are not dismissing on Safari

I'm finding that the tooltips are not dismissing on Safari Version 11.1 (13605.1.33.1.4)

When you hover over a tooltip they do not dismiss afterwards. They stay there until you reload the page.

To replicate run your mouse over a tooltip trigger multiple times and after a few times the tooltip will no longer dismiss.

They are dismissing correctly on Chrome and Firefox, it is a browser specific issue.

A sample of the code I am using is:

<ion-split-pane>
  <ion-menu [content]="content" [swipeEnabled]="false" type="overlay">
    <ion-content #content>
      <ion-list no-lines margin-top>
        <button ion-item (tap)="openPage('BookingCalendarPage')" [tooltip]="!menuCollapsed ? '' : 'Bookings'" event="hover" positionH="right" arrow=true duration=100>
          <ion-icon name='calendar' item-left active="true"></ion-icon><span *ngIf="!menuCollapsed">Bookings</span>
        </button>
        <button ion-item (tap)="openPage('ClientDirectoryPage')" [tooltip]="!menuCollapsed ? '' : 'Clients'" event="hover" positionH="right" arrow=true >
          <ion-icon name='person' item-left></ion-icon><span *ngIf="!menuCollapsed">Clients</span>
        </button>
      </ion-list>
    </ion-content>
  </ion-menu>
</ion-split-pane>

Has anyone else experienced this?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.