-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler): fallback to ES2015 when no target is defined
Closes #622
- Loading branch information
Showing
6 changed files
with
105 additions
and
73 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
e2e/test-app-v10/projects/my-lib/src/lib/disableable.directive.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Directive, ElementRef, Input } from '@angular/core'; | ||
|
||
/** | ||
* A base class for components that can be disabled, and that store their disabled | ||
* state in the HTML element. This prevents the HTML element from being focused or clicked, | ||
* and can be used for CSS selectors. | ||
*/ | ||
@Directive() | ||
export abstract class DisableableDirective { | ||
|
||
/** Binds to the HTML disabled property OR disabled attribute, if present. */ | ||
@Input() | ||
public set disabled(v: boolean) { | ||
const elt = this.elementRef.nativeElement; | ||
const disabledProp = (elt as any).disabled; | ||
if (typeof (disabledProp) === 'boolean') { | ||
// Set disabled property | ||
(elt as any).disabled = v; | ||
return; | ||
} | ||
|
||
// Set disabled attribute | ||
elt.setAttribute('disabled', v.toString()); | ||
} | ||
public get disabled(): boolean { | ||
const elt = this.elementRef.nativeElement; | ||
const disabledProp = (elt as any).disabled; | ||
if (typeof (disabledProp) === 'boolean') { | ||
return disabledProp; | ||
} | ||
const disabledAttr = elt.getAttribute('disabled'); | ||
return disabledAttr === 'true'; | ||
} | ||
|
||
constructor(public elementRef: ElementRef<HTMLElement>) { } | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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