Comments (4)
Please Notice, Aurelia has an issue with using for
attribute on non <label>
.
For menu element you can use data-mdl-for
attribute instead of for
. But for tooltips MDL didn't implement it, so if you use binding/string interpolation, until the Aurelia bug is fixed, use label
as in the example below.
Allow me to suggest wrapping it in custom element.
I'm successfully using it as:
// button-icon.html
<template bindable="click" bindable="tooltipEn">
<div click.delegate="clickHandle($event)" mdl="button" class="mdl-js-ripple-effect mdl-button--icon" id="button-${id}">
<i class="material-icons md-dark">
<template replaceable part="icon"></template> <!--touch_app-->
</i>
</div>
<label if.bind="tooltipEn" mdl="tooltip" class="mdl-tooltip--large" for="button-${id}">
<template replaceable part="tooltip">click</template>
</label>
</template>
// button-icon.js
import {bindable, customElement} from 'aurelia-framework';
import {guid} from '../util';
@customElement('button-icon')
export class ButtonIcon {
id = guid(); // generate unique guid
@bindable tooltipEn = false;
@bindable click;
clickHandle(e) {
if (typeof this.click === 'function') {
this.click({event: e});
}
}
}
Usage:
<button-icon click.call="myClickAction()" tooltip-en.one-way="enableTooltip">
<template replace-part="icon"></template> <!--exit_to_app-->
<template replace-part="tooltip">This is my tool tip</template>
</button-icon>
I haven't used mdl-tooltip--right
yet...
from aurelia-mdl.
Interesting workaround!
A good use for template replace-part
- I (being a n00b) was wondering where that would be needed.
Thanks for your answer - I'll see how I go with that! 😃
from aurelia-mdl.
I tried just changing my tooltip from a div
to a label
and it's happy now, so my use case is:
<span class="mdl-list__item-secondary-action">
<button id="edit_${$index}" mdl="button" class="mdl-button--icon mdl-button--colored">
<i class="mdi mdi-pencil"></i>
</button>
<label mdl="tooltip" class="mdl-tooltip--large" for="edit_${$index}">
Edit Task
</label>
</span>
And yeah, only --large
works for me..
from aurelia-mdl.
Just hit this and thought I was going crazy!
from aurelia-mdl.
Related Issues (13)
- 404 when using encapsulated-mdl HOT 2
- WebPack Support HOT 6
- Tabs - Failed to execute 'querySelector' on 'Element' HOT 2
- Trying to use in the aurelia-cli HOT 6
- Will you be upgrading it to latest mdl? HOT 4
- Ability to extend `mdlTypes` to add support for custom MDL elements. HOT 3
- Issue when rendering mdl-layout HOT 7
- Timeout on Snackbar HOT 3
- Using different icon sets HOT 3
- Weird issue with textfield HOT 9
- Example request: How to use a modal? HOT 3
- checkbox and switch not updating when bound property changes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aurelia-mdl.