Skip to content

Commit

Permalink
feat(tooltip): adds implementation to tooltipEnable (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcg authored and valorkin committed May 25, 2016
1 parent 558e96c commit 1470892
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/tooltip/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class TooltipDirective implements OnInit {
- `tooltipAnimation` (`?boolean=true`) - if `false` fade tooltip animation will be disabled
- `tooltipPopupDelay` (*not implemented*) (`?numer=0`) - time in milliseconds before tooltip occurs
- `tooltipTrigger` (*not implemented*) (`?Array<string>`) - array of event names which triggers tooltip opening
- `tooltipEnable` (*not implemented*) (`?boolean=true`) - if `false` tooltip is disabled and will not be shown
- `tooltipEnable` (`?boolean=true`) - if `false` tooltip is disabled and will not be shown
- `tooltipAppendToBody` (*not implemented*) (`?boolean=false`) - if `true` tooltip will be appended to body
- `tooltipClass` (*not implemented*) (`?string`) - custom tooltip class applied to the tooltip container.
- `tooltipIsOpen` (`?boolean=false`) - if `true` tooltip is currently visible
4 changes: 2 additions & 2 deletions components/tooltip/tooltip.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class TooltipDirective {
@Input('tooltip') public content:string;
@Input('tooltipPlacement') public placement:string = 'top';
@Input('tooltipIsOpen') public isOpen:boolean;
@Input('tooltipEnable') public enable:boolean;
@Input('tooltipEnable') public enable:boolean = true;
@Input('tooltipAnimation') public animation:boolean = true;
@Input('tooltipAppendToBody') public appendToBody:boolean;
/* tslint:enable */
Expand All @@ -32,7 +32,7 @@ export class TooltipDirective {
@HostListener('focusin', ['$event', '$target'])
@HostListener('mouseenter', ['$event', '$target'])
public show():void {
if (this.visible) {
if (this.visible || !this.enable) {
return;
}
this.visible = true;
Expand Down
4 changes: 2 additions & 2 deletions demo/components/tooltip/tooltip-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@

<div class="form-group" ngClass="{'has-error' : !inputModel}">
<label>Disable tooltips conditionally:</label>
<input type="text" ngModel="inputModel" class="form-control"
<input type="text" [(ngModel)]="inputModel" class="form-control"
placeholder="Hover over this for a tooltip until this is filled"
tooltip="Enter something in this input field to disable this tooltip"
tooltipPlacement="top"
tooltipTrigger="mouseenter"
tooltipEnable="!inputModel" />
[tooltipEnable]="!inputModel || inputModel.length==0" />
</div>
</form>

0 comments on commit 1470892

Please sign in to comment.