Skip to content

Commit 84e2b89

Browse files
committed
Merge pull request #98 from panzerdp/issue-97
Fix the empty tooltip verification
2 parents c21f304 + 5047e4e commit 84e2b89

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

Readme.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,21 @@ using the `tooltip-view=""` attribute
120120
```html
121121
<a href="#" tooltips tooltip-title="tip" tooltip-view="path/to/view.html">Tooltip me</a>
122122
```
123+
124+
####Tooltip view model
125+
You can set a model for your tooltip view
126+
using the `tooltip-view-model=""`
127+
128+
```html
129+
<a href="#" tooltips tooltip-title="tip" tooltip-view-model="myModel" tooltip-view="path/to/view.html">Tooltip me</a>
130+
```
131+
then use it in your tooltip html template:
132+
133+
```html
134+
<!-- path/to/view.html -->
135+
<span>Tooltip me with data - {{ tooltipViewModel.myModel }}</span>
136+
```
137+
123138
####Tooltip view controller
124139
You can set a controller for your tooltip view
125140
using the `tooltip-view=""` together with `tooltip-view-ctrl=""` attribute

src/js/angular-tooltips.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@
4444

4545
return {
4646
'restrict': 'A',
47-
'scope': {},
47+
'scope': {
48+
tooltipViewModel: '='
49+
},
4850
'link': function linkingFunction($scope, element, attr) {
4951

5052
var initialized = false
@@ -138,7 +140,7 @@
138140

139141
$scope.isTooltipEmpty = function checkEmptyTooltip() {
140142

141-
if (!$scope.title && !$scope.content && !$scope.html) {
143+
if (!$scope.title && !$scope.content && !$scope.html && !attr.tooltipView) {
142144

143145
return true;
144146
}

0 commit comments

Comments
 (0)