components icon indicating copy to clipboard operation
components copied to clipboard

tooltip

Open maryamsoprano opened this issue 10 years ago • 14 comments

I try to implement md-tooltip for showing description whenever I hover on a Icon. But I don't know why it does'nt work and it does'nt show any message. I also tried the sample one in angular2/material.tooltip , but same problem. My code is as bellow:

<button

   md-raised-button

    color="primary"

   md-tooltip="to see a tooltip"

    tooltip-position="below">

  Mouse over this link
I need an urgent help, thanks alot.

maryamsoprano avatar Aug 10 '16 02:08 maryamsoprano

Hello,

Did you import the directive in the component?

BobBDE avatar Aug 10 '16 08:08 BobBDE

Thanks for your response. I imported @angular2-material/tooltip into my component and also add it into directive. Tooltip version is 2.0.0alpha7 , and other components of angular2-material are in version alpha6 ( they are defined in package. Json) Do you think integration of tooltips with other material components can cause problem?

maryamsoprano avatar Aug 10 '16 10:08 maryamsoprano

I can confirm this issue. If you hover over a button with the above tooltip definition for the first time, the chrome debugger console throws out the following warning: ComponentResolver is deprecated for dynamic compilation. Use ComponentFactoryResolver together with @NgModule/@Component.entryComponents or ANALYZE_FOR_ENTRY_COMPONENTS provider instead. For runtime compile only, you can also use Compiler.compileComponentSync/Async.

Avareto avatar Aug 10 '16 16:08 Avareto

@maryamsoprano if you're still having the issue you described in https://github.com/angular/material2/issues/980, then you're not successfully loading tooltip.js, which means the tooltip code is not present.

@Avareto that warning is just from a deprecated API, but shouldn't cause any problems (angular core has been deprecating them faster than we can replace them...). Do you have any other information to help debug?

cc @robertmesserle

jelbourn avatar Aug 10 '16 17:08 jelbourn

Hi , Let me describe all the steps First I installed @angular2-material/tooltip, and added "@angular2-material/tooltip": "^2.0.0-alpha.7", in my package.json. run npm install @angular2-material/tooltip.

second, This component is added into systemjs.config.js. third,I started importing tooltip:

import {MD_TOOLTIP_DIRECTIVES} from '@angular2-material/tooltip'; @Component({

selector: 'contacts', templateUrl: './app/views/contacts/contacts.html', styleUrls: ['./app/css/ui.css'], directives: [ SEI_DIRECTIVES,MD_TOOLTIP_DIRECTIVES ], providers: [ ContactsService ] }) finally,run it by gulp following error is shown in my browser console:

es6-shim.min.js:11:16380 Error: (SystemJS) BaseException@http://localhost:3000/node_modules/@angular/core/src/facade/exceptions.js:27:23 AbstractProviderError@http://localhost:3000/node_modules/@angular/core/src/di/reflective_exceptions.js:43:9 NoProviderError@http://localhost:3000/node_modules/@angular/core/src/di/reflective_exceptions.js:80:9 ReflectiveInjector_.prototype.throwOrNull@http://localhost:3000/node_modules/@angular/core/src/di/reflective_injector.js:786:19 ReflectiveInjector.prototype.getByKeyDefault@http://localhost:3000/node_modules/@angular/core/src/di/reflective_injector.js:814:20 ReflectiveInjector.prototype.getByKey@http://localhost:3000/node_modules/@angular/core/src/di/reflective_injector.js:777:20 ReflectiveInjector.prototype.getByReflectiveDependency@http://localhost:3000/node_modules/@angular/core/src/di/reflective_injector.js:767:16 ReflectiveInjector.prototype.instantiate@http://localhost:3000/node_modules/@angular/core/src/di/reflective_injector.js:665:31 ReflectiveInjector.prototype.instantiateProvider@http://localhost:3000/node_modules/@angular/core/src/di/reflective_injector.js:636:20 ReflectiveInjector.prototype.new@http://localhost:3000/node_modules/@angular/core/src/di/reflective_injector.js:625:16 ReflectiveInjectorDynamicStrategy.prototype.getObjByKeyId@http://localhost:3000/node_modules/@angular/core/src/di/reflective_injector.js:277:1 ReflectiveInjector.prototype.getByKeyDefault@http://localhost:3000/node_modules/@angular/core/src/di/reflective_injector.js:805:23 ReflectiveInjector.prototype.getByKey@http://localhost:3000/node_modules/@angular/core/src/di/reflective_injector.js:777:20 ReflectiveInjector.prototype.get@http://localhost:3000/node_modules/@angular/core/src/di/reflective_injector.js:586:16 analyzeAppProvidersForDeprecatedConfiguration@http://localhost:3000/node_modules/@angular/compiler/src/compiler.js:99:26 bootstrap@http://localhost:3000/node_modules/@angular/platform-browser-dynamic/index.js:117:35 .execute@http://localhost:3000/app/main.js:57:1 Zone</ZoneDelegate</ZoneDelegate.prototype.invoke@http://localhost:3000/node_modules/zone.js/dist/zone.js:323:20 Zone</Zone</Zone.prototype.run@http://localhost:3000/node_modules/zone.js/dist/zone.js:216:25 scheduleResolveOrReject/<@http://localhost:3000/node_modules/zone.js/dist/zone.js:571:53 Zone</ZoneDelegate</ZoneDelegate.prototype.invokeTask@http://localhost:3000/node_modules/zone.js/dist/zone.js:356:24 Zone</Zone</Zone.prototype.runTask@http://localhost:3000/node_modules/zone.js/dist/zone.js:256:29 drainMicroTaskQueue@http://localhost:3000/node_modules/zone.js/dist/zone.js:474:26 ZoneTask/this.invoke@http://localhost:3000/node_modules/zone.js/dist/zone.js:426:22

Error loading http://localhost:3000/app/main.js localhost:3000:20:51

Everytime I changed the version of dependencies in package.json. description of error is changed.

Package.json: { "name": "ng2_play", "version": "1.0.0", "description": "- Blog @ http://www.towfeek.se/2015/07/angularjs-2-overview/\r - Screencast @ https://youtu.be/rd3cLh_wn04", "main": "gulpfile.js", "scripts": { "test": "echo "Error: no test specified" && exit 1" }, "repository": { "type": "git", "url": "git+https://github.com/ajtowf/ng2_play.git" }, "author": "Ajden Towfeek", "license": "MIT", "bugs": { "url": "https://github.com/ajtowf/ng2_play/issues" }, "homepage": "https://github.com/ajtowf/ng2_play#readme", "devDependencies": { "browser-sync": "^2.9.3", "gulp": "^3.9.0", "gulp-sourcemaps": "^1.5.2", "gulp-tslint": "^3.2.0", "gulp-typescript": "^2.13.4", "superstatic": "^1.2.3", "typings": "^1.0.4" }, "dependencies": { "@angular/common": "^2.0.0-rc.4", "@angular/compiler": "^2.0.0-rc.4", "@angular/core": "2.0.0-rc.5", "@angular/http": "^2.0.0-rc.4", "@angular/platform-browser": "^2.0.0-rc.4", "@angular/platform-browser-dynamic": "^2.0.0-rc.4", "@angular/router": "3.0.0-alpha.8", "@angular/forms": "^0.2.0", "@angular2-material/button": "^2.0.0-alpha.6", "@angular2-material/card": "^2.0.0-alpha.6", "@angular2-material/checkbox": "^2.0.0-alpha.6", "@angular2-material/core": "^2.0.0-alpha.6", "@angular2-material/icon": "^2.0.0-alpha.6", "@angular2-material/input": "^2.0.0-alpha.6", "@angular2-material/list": "^2.0.0-alpha.6", "@angular2-material/progress-bar": "^2.0.0-alpha.6", "@angular2-material/progress-circle": "^2.0.0-alpha.6", "@angular2-material/radio": "^2.0.0-alpha.6", "@angular2-material/sidenav": "^2.0.0-alpha.6", "@angular2-material/toolbar": "^2.0.0-alpha.6", "@angular2-material/tabs": "^2.0.0-alpha.6", "@angular2-material/menu": "^2.0.0-alpha.6", "@angular2-material/tooltip": "^2.0.0-alpha.7", "angular2-jwt": "^0.1.15", "cors": "2.7.1", "es6-promise": "3.2.1", "es6-shim": "^0.35.0", "express": "4.14.0", "express-jwt": "3.4.0", "ng2-material": "^0.5.0", "reflect-metadata": "0.1.3", "rxjs": "^5.0.0-beta.10", "symbol-observable": "^1.0.1", "systemjs": "0.19.31", "zone.js": "^0.6.12", "angular2-in-memory-web-api": "^0.0.14" } }

maryamsoprano avatar Aug 10 '16 22:08 maryamsoprano

When I changed the version of @angular/core into "2.0.0-rc.4" instead of "2.0.0-rc.5" ,description of error has changed: Error: (SystemJS) @http://localhost:3000/node_modules/@angular/compiler/src/schema/dom_security_schema.js:29:1 @http://localhost:3000/node_modules/@angular/compiler/src/schema/dom_security_schema.js:1:1 @http://localhost:3000/node_modules/@angular/compiler/src/schema/dom_security_schema.js:1:1 @http://localhost:3000/node_modules/@angular/compiler/src/schema/dom_element_schema_registry.js:17:29 @http://localhost:3000/node_modules/@angular/compiler/src/schema/dom_element_schema_registry.js:1:1 @http://localhost:3000/node_modules/@angular/compiler/src/schema/dom_element_schema_registry.js:1:1 @http://localhost:3000/node_modules/@angular/compiler/src/compiler.js:43:37 @http://localhost:3000/node_modules/@angular/compiler/src/compiler.js:1:1 @http://localhost:3000/node_modules/@angular/compiler/src/compiler.js:1:1 @http://localhost:3000/node_modules/@angular/compiler/index.js:19:18 @http://localhost:3000/node_modules/@angular/compiler/index.js:1:1 @http://localhost:3000/node_modules/@angular/compiler/index.js:1:1 @http://localhost:3000/node_modules/@angular/platform-browser-dynamic/index.js:9:18 @http://localhost:3000/node_modules/@angular/platform-browser-dynamic/index.js:1:1 @http://localhost:3000/node_modules/@angular/platform-browser-dynamic/index.js:1:1 Zone</ZoneDelegate</ZoneDelegate.prototype.invoke@http://localhost:3000/node_modules/zone.js/dist/zone.js:323:20 Zone</Zone</Zone.prototype.run@http://localhost:3000/node_modules/zone.js/dist/zone.js:216:25 scheduleResolveOrReject/<@http://localhost:3000/node_modules/zone.js/dist/zone.js:571:53 Zone</ZoneDelegate</ZoneDelegate.prototype.invokeTask@http://localhost:3000/node_modules/zone.js/dist/zone.js:356:24 Zone</Zone</Zone.prototype.runTask@http://localhost:3000/node_modules/zone.js/dist/zone.js:256:29 drainMicroTaskQueue@http://localhost:3000/node_modules/zone.js/dist/zone.js:474:26 ZoneTask/this.invoke@http://localhost:3000/node_modules/zone.js/dist/zone.js:426:22

Evaluating http://localhost:3000/node_modules/@angular/compiler/src/schema/dom_security_schema.js
Evaluating http://localhost:3000/node_modules/@angular/compiler/src/schema/dom_element_schema_registry.js
Evaluating http://localhost:3000/node_modules/@angular/compiler/src/compiler.js
Evaluating http://localhost:3000/node_modules/@angular/compiler/index.js
Evaluating http://localhost:3000/node_modules/@angular/platform-browser-dynamic/index.js
Error loading http://localhost:3000/app/main.js

May this problem just related to my pacakge,json file and dependecies inside that? or I am in the wrong way . something else can cause these errors?

maryamsoprano avatar Aug 10 '16 22:08 maryamsoprano

I just saw that you updated your demo https://github.com/jelbourn/material2-app to rc.5. Did you add a tooltip sample there? I did the update myself locally and everything worked as before in rc.4. Than I added new rc.5 features which worked, but tooltips didn't.

Avareto avatar Aug 10 '16 22:08 Avareto

I was actually updating material2-app so that I could debug this issue. I figured out that the problem is that the overlay styles aren't being included in the app. In the short term, you can simply add a <link> element for core/overlay/overlay.css. In the next release we'll have something like a angular-material-core.css in the package root and instructions on including it.

jelbourn avatar Aug 10 '16 23:08 jelbourn

Hi jelbourn,

What do you think about integration o tooltip and other angualr2-material componnets? Is these kind of errors related to version in package file?

maryamsoprano avatar Aug 11 '16 00:08 maryamsoprano

@maryamsoprano I think your errors are unrelated to material. Be sure to read up about the changes in Angular itself for RC5.

jelbourn avatar Aug 11 '16 00:08 jelbourn

I followed your demo code,also updated my package file probably. but still has following error. I can't find exact place of code caused this problems

Error: Uncaught (in promise): Template parse errors: Can't bind to 'md-ripple-trigger' since it isn't a known property of 'div'. ("*ngIf="isRippleEnabled()" class="md-button-ripple" [class.md-button-ripple-round]="isRoundButton()" [ERROR ->][md-ripple-trigger]="getHostElement()" [md-ripple-color]="isRoundButton() ? 'rgba(255, 255, 255, 0.2)"): MdButton@0:180 Can't bind to 'md-ripple-color' since it isn't a known property of 'div'. ("ton-ripple" [class.md-button-ripple-round]="isRoundButton()" [md-ripple-trigger]="getHostElement()" [ERROR ->][md-ripple-color]="isRoundButton() ? 'rgba(255, 255, 255, 0.2)' : ''" md-ripple-background-color="rgb"): MdButton@0:219 Stack trace: resolvePromise@http://localhost:3000/node_modules/zone.js/dist/zone.js:538:32 resolvePromise@http://localhost:3000/node_modules/zone.js/dist/zone.js:523:18 scheduleResolveOrReject/<@http://localhost:3000/node_modules/zone.js/dist/zone.js:571:18 Zone</ZoneDelegate</ZoneDelegate.prototype.invokeTask@http://localhost:3000/node_modules/zone.js/dist/zone.js:356:24 Zone</Zone</Zone.prototype.runTask@http://localhost:3000/node_modules/zone.js/dist/zone.js:256:29 drainMicroTaskQueue@http://localhost:3000/node_modules/zone.js/dist/zone.js:474:26 ZoneTask/this.invoke@http://localhost:3000/node_modules/zone.js/dist/zone.js:426:22

maryamsoprano avatar Aug 11 '16 01:08 maryamsoprano

@maryamsoprano See #973

jelbourn avatar Aug 11 '16 01:08 jelbourn

it works if we add core/overlay/overlay.css, but we still get the warning "ComponentResolver is deprecated for dynamic compilation. Use ComponentFactoryResolver together with @NgModule/@Component.entryComponents or ANALYZE_FOR_ENTRY_COMPONENTS provider instead. For runtime compile only, you can also use Compiler.compileComponentSync/Async." on mouseover

fernandogomesdf avatar Aug 30 '16 21:08 fernandogomesdf

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.