src/link/link.directive.ts
A convinence directive for applying styling to a link.
Example:
* <a href="#" ibmLink>A link</a>
*See the vanilla carbon docs for more detail.
| Selector | [ibmLink] |
Properties |
|
Inputs |
HostBindings |
Accessors |
disabled
|
Set to true to disable link.
Type : |
|
Defined in src/link/link.directive.ts:41
|
|
| attr.tabindex |
attr.tabindex:
|
|
Defined in src/link/link.directive.ts:33
|
|
Automatically set to |
| class.bx--link |
class.bx--link:
|
Default value : true
|
|
Defined in src/link/link.directive.ts:28
|
| Private _disabled |
_disabled:
|
|
Defined in src/link/link.directive.ts:50
|
| disabled | ||||||
getdisabled()
|
||||||
|
Defined in src/link/link.directive.ts:46
|
||||||
setdisabled(disabled: boolean)
|
||||||
|
Defined in src/link/link.directive.ts:41
|
||||||
|
Set to true to disable link.
Parameters :
Returns :
void
|
import {
Directive,
HostBinding,
Input
} from "@angular/core";
/**
* A convinence directive for applying styling to a link.
*
* [See demo](../../?path=/story/link--basic)
*
* Example:
*
* ```hmtl
* <a href="#" ibmLink>A link</a>
* ```
*
* See the [vanilla carbon docs](http://www.carbondesignsystem.com/components/link/code) for more detail.
*
* <example-url>../../iframe.html?id=link--basic</example-url>
*/
@Directive({
selector: "[ibmLink]"
})
export class Link {
@HostBinding("class.bx--link") baseClass = true;
/**
* Automatically set to `-1` when link is disabled.
*/
@HostBinding("attr.tabindex") tabindex;
/**
* Set to true to disable link.
*/
@Input()
@HostBinding("attr.aria-disabled")
@HostBinding("class.bx--link--disabled")
set disabled(disabled: boolean) {
this._disabled = disabled;
this.tabindex = this.disabled ? -1 : null;
}
get disabled(): boolean {
return this._disabled;
}
private _disabled;
}