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:37
|
|
| attr.tabindex |
attr.tabindex:
|
|
Defined in src/link/link.directive.ts:29
|
|
Automatically set to |
| class.bx--link |
class.bx--link:
|
Default value : true
|
|
Defined in src/link/link.directive.ts:23
|
| Private _disabled |
_disabled:
|
|
Defined in src/link/link.directive.ts:46
|
| disabled | ||||||||
getdisabled()
|
||||||||
|
Defined in src/link/link.directive.ts:42
|
||||||||
|
Returns :
boolean
|
||||||||
setdisabled(disabled: boolean)
|
||||||||
|
Defined in src/link/link.directive.ts:37
|
||||||||
|
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.
*
* Example:
*
* ```hmtl
* <a href="#" ibmLink>A link</a>
* ```
*
* See the [vanilla carbon docs](http://www.carbondesignsystem.com/components/link/code) for more detail.
*/
@Directive({
selector: "[ibmLink]"
})
export class Link {
@HostBinding("class.bx--link") baseClass = true;
/**
* Automatically set to `-1` when link is disabled.
* @memberof Link
*/
@HostBinding("attr.tabindex") tabindex;
/**
* Set to true to disable link.
* @memberof Link
*/
@Input()
@HostBinding("attr.aria-disabled")
set disabled(disabled: boolean) {
this._disabled = disabled;
this.tabindex = this.disabled ? -1 : null;
}
get disabled(): boolean {
return this._disabled;
}
private _disabled;
}