Last active
November 23, 2015 22:12
-
-
Save amk221/1ace9798eb3c3bb891b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/x-handlebars" data-template-name="application"> | |
| {{#tool-tipper text='Fred Smith'}}Fred{{/tool-tipper}}<br> | |
| {{#tool-tipper text='Joe Bloggs'}}John{{/tool-tipper}}<br> | |
| {{#tool-tipper text='Jane Doe'}}Jane{{/tool-tipper}}<br> | |
| {{tool-tips}} | |
| </script> | |
| <script type="text/x-handlebars" data-template-name="components/tool-tip"> | |
| {{attrs.text}} | |
| </script> | |
| <script type="text/x-handlebars" data-template-name="components/tool-tips"> | |
| {{#if text}} | |
| {{tool-tip text=text}} | |
| {{/if}} | |
| </script> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var app = Ember.Application.create(); | |
| app.TooltipsService = Ember.Service; | |
| app.ToolTipsComponent = Ember.Component.extend({ | |
| tagName: '', | |
| tooltips: Ember.inject.service(), | |
| text: Ember.computed.alias('tooltips.text') | |
| }); | |
| app.ToolTipperComponent = Ember.Component.extend({ | |
| tooltips: Ember.inject.service(), | |
| mouseEnter: function() { | |
| this.set('tooltips.text', this.getAttr('text')); | |
| }, | |
| mouseLeave: function() { | |
| this.set('tooltips.text', null); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment