In my project I have a generic class and some other components which inherited from that.
BaseRdnInput.ts:
@Injectable()
export abstract class BaseRdnInput implements ControlValueAccessor, Validator {
@Input() rdnModel?: any | Array<any>;
@Output() rdnModelChange: EventEmitter<any | Array<any>> = new EventEmitter<any | Array<any>>();
// many code after...
}
RdnInputComponent.ts:
@Component({
// tslint:disable-next-line:component-selector
selector: 'rdn-input',
templateUrl: './rdn-input.component.html'
})
export class RdnInputComponent extends BaseRdnInput implements OnInit, AfterViewInit {
// many code after...
constructor(public changeDetectorRef: ChangeDetectorRef) {
super(changeDetectorRef);
};
// many code after
}
Then I am using this component in ContractComponent.html:
<rdn-input [(rdnModel)]='headerEntity.saleNo'></rdn-input>
By this line of code I get this error :
Can't bind to 'rdnModel' since it isn't a known property of 'rdn-input'.
- If 'rdn-input' is an Angular component and it has 'rdnModel' input, then verify that it is part of this module.
- If 'rdn-input' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
- To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.
It was working fine before I upgrading. My question is very similar to this one: Angular2 RC5: Can't bind to 'Property X' since it isn't a known property of 'Child Component'. I got that there are some setps to avoid this error and the most important is:
checking if we add @input to the property of sub class or adding attr to the biding property of parent.
if you see I have already added @input
in BaseRdnInput.ts:. and I don't want to use attr because it will stop that property from being passed down to nested directives. Is there anyway to pass this?