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
input { | |
border:1px solid #0080ff; | |
background-color:#fff; | |
color:#0080ff; | |
} | |
input:disabled, | |
input[disabled]{ | |
border:1px solid #d3d3d3; | |
background-color:#fafafa; |
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
input { | |
cursor:pointer; | |
padding:10px; | |
} | |
input:disabled, | |
input[disabled]{ | |
cursor:auto; | |
} |
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
<div class="cell" [ngClass]="classes"> | |
<label class="label"> | |
<span [innerHTML]="label"></span> | |
</label> | |
<input type="text" | |
class="input" | |
[disabled]="disabled" | |
[placeholder]="placeholder"> | |
<div class="alert"> {{ alert }} </div> | |
</div> |
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
import { Component, Input } from '@angular/core'; | |
@Component({ | |
selector: 'custom-input', | |
templateUrl: 'src/custom-input.component.html', | |
styleUrls: ['src/custom-input.component.css'] | |
}) | |
export class CustomInput { | |
classes: string; |
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
export class CustomRange extends AbstractValueAccessor<number> { | |
@Input() label: string; | |
} |
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
export class CustomInput extends AbstractValueAccessor<string> { | |
@Input() label: string; | |
} |
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
export abstract class AbstractValueAccessor<T> implements ControlValueAccessor { | |
_value: T = ''; | |
get value(): T { return this._value; }; | |
set value(v: T) { | |
if (v !== this._value) { | |
this._value = v; | |
this.onChange(v); | |
} | |
} |
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
export function MakeProvider(type : any){ | |
return { | |
provide: NG_VALUE_ACCESSOR, | |
useExisting: forwardRef(() => type), | |
multi: true | |
}; | |
} |