Skip to content

Commit

Permalink
fix(angular): only listen to host balChanges
Browse files Browse the repository at this point in the history
  • Loading branch information
hirsch88 committed Dec 12, 2022
1 parent b444de8 commit ecd3e2a
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ValueAccessor } from './value-accessor'
/* tslint:disable-next-line:directive-selector */
selector: 'bal-popover, bal-accordion',
host: {
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event)',
'(balChange)': 'handleChangeEvent($event)',
},
providers: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ValueAccessor } from './value-accessor'
/* tslint:disable-next-line:directive-selector */
selector: 'bal-checkbox',
host: {
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event)',
'(balChange)': 'handleChangeEvent($event)',
},
providers: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ValueAccessor } from './value-accessor'
/* tslint:disable-next-line:directive-selector */
selector: 'bal-number-input, bal-input-stepper',
host: {
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event)',
'(balInput)': 'handleChangeEvent($event)',
},
providers: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ValueAccessor } from './value-accessor'
/* tslint:disable-next-line:directive-selector */
selector: 'bal-radio-group, bal-checkbox-group, bal-select, bal-datepicker, bal-tabs',
host: {
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event)',
'(balChange)': 'handleChangeEvent($event)',
},
providers: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ValueAccessor } from './value-accessor'
/* tslint:disable-next-line:directive-selector */
selector: 'bal-input, bal-textarea, bal-input-slider',
host: {
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event)',
'(balInput)': 'handleChangeEvent($event)',
},
providers: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export class ValueAccessor implements ControlValueAccessor {
}

handleChangeEvent(event: CustomEvent<any>) {
console.log('handleChangeEvent', this.el.nativeElement, this.el.nativeElement === event.target, event)
if (this.el.nativeElement === event.target) {
const value = event.detail
if (value !== this.lastValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export class ValueAccessor implements ControlValueAccessor {
}

handleChangeEvent(event: CustomEvent<any>) {
console.log('handleChangeEvent', this.el.nativeElement, this.el.nativeElement === event.target, event)
if (this.el.nativeElement === event.target) {
const value = event.detail
if (value !== this.lastValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ function copyResources(config: Config, resourcesFilesToCopy: string[], directory
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>'
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.detail)'`
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event)'`

0 comments on commit ecd3e2a

Please sign in to comment.