my-ngx-bind-outputs.service.ts
import { Injectable } from '@angular/core';
import { IBindIO, NgxBindOutputsService } from 'ngx-bind-io';
@Injectable()
export class MyNgxBindOutputsService extends NgxBindOutputsService {
checkKeyNameToOutputBind(directive: Partial<INgxBindIODirective>, hostKey: string, innerKey: string) {
const outputs = directive.outputs;
const keyWithFirstUpperLetter = innerKey.length > 0 ? innerKey.charAt(0).toUpperCase() + innerKey.substr(1) : innerKey;
return (
(hostKey === `on${keyWithFirstUpperLetter}` &&
outputs.hostKeys.indexOf(`on${keyWithFirstUpperLetter}Click`) === -1 &&
outputs.hostKeys.indexOf(`on${keyWithFirstUpperLetter}ButtonClick`) === -1) ||
(hostKey === `on${keyWithFirstUpperLetter}Click` &&
outputs.hostKeys.indexOf(`on${keyWithFirstUpperLetter}ButtonClick`) === -1) ||
hostKey === `on${keyWithFirstUpperLetter}ButtonClick`
);
}
}
app.module.ts
import { NgxBindOutputsService, NgxBindIOModule } from 'ngx-bind-io';
import { MyNgxBindOutputsService } from './shared/utils/my-ngx-bind-outputs.service';
import { InnerComponent } from './inner.component';
import { HostComponent } from './host.component';
@NgModule({
declarations: [AppComponent],
imports: [
...
NgxBindIOModule,
...
],
declarations: [
AppComponent,
InnerComponent,
HostComponent,
...
],
providers: [
...
{ provide: NgxBindOutputsService, useClass: MyNgxBindOutputsService },
...
],
bootstrap: [AppComponent]
})
export class AppModule { }
ngx-bind-outputs.service.ts
export class NgxBindOutputsService {
...
checkKeyNameToOutputBind(directive: Partial<INgxBindIODirective>, hostKey: string, innerKey: string) {
const outputs = directive.outputs;
const keyWithFirstUpperLetter = innerKey.length > 0 ? innerKey.charAt(0).toUpperCase() + innerKey.substr(1) : innerKey;
return (
(hostKey === `on${keyWithFirstUpperLetter}` &&
outputs.hostKeys.indexOf(`on${keyWithFirstUpperLetter}Click`) === -1) ||
hostKey === `on${keyWithFirstUpperLetter}Click`
);
}
...
}
ngx-bind-inputs.service.ts
export class NgxBindInputsService {
...
checkKeyNameToInputBind(directive: Partial<INgxBindIODirective>, hostKey: string, innerKey: string) {
return hostKey === innerKey && hostKey[0] !== '_';
}
...
checkKeyNameToObservableInputBind(directive: Partial<INgxBindIODirective>, hostKey: string, innerKey: string) {
return hostKey === `${innerKey}$` && hostKey[0] !== '_';
}
...
}