Skip to content

Commit

Permalink
Thêm ControlValueAccessor
Browse files Browse the repository at this point in the history
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
  • Loading branch information
leanhducprovn committed Jun 10, 2022
1 parent 7440f52 commit 47d1111
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion angular/src/app/bravo-slider/bravo-slider.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,31 @@ import {
Component,
ElementRef,
EventEmitter,
forwardRef,
Input,
OnInit,
Output,
} from '@angular/core';
import * as wjc from '@grapecity/wijmo';

import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';

@Component({
selector: 'bravo-slider',
templateUrl: './bravo-slider.component.html',
styleUrls: ['./bravo-slider.component.css'],
providers: [
{
provide: NG_VALUE_ACCESSOR,
multi: true,
useExisting: forwardRef(() => BravoSliderComponent),
},
],
})
export class BravoSliderComponent extends wjc.Control implements OnInit {
export class BravoSliderComponent
extends wjc.Control
implements OnInit, ControlValueAccessor
{
@Input()
public start!: number;

Expand Down Expand Up @@ -191,6 +204,19 @@ export class BravoSliderComponent extends wjc.Control implements OnInit {
super(elementRef.nativeElement);
}

private onTouchedCallback = (value: any) => {};
private onChangeCallback = (value: any) => {};

writeValue(obj: any): void {}

public registerOnChange(onChangeCallback: any): void {
this.onChangeCallback = onChangeCallback;
}

public registerOnTouched(onTouchedCallback: any): void {
this.onTouchedCallback = onTouchedCallback;
}

override refresh(fullUpdate?: boolean): void {
this.bubble(this.isBubble);
this.pointer(
Expand Down

1 comment on commit 47d1111

@vercel
Copy link

@vercel vercel bot commented on 47d1111 Jun 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.