Hi everyone,I have a problem when I try to use the "igx-radio-group" in my Angular App.
I followed the steps in the documentation and imported the IgxRadioModule.Then I used the radio-buttons and the radio-group like this in my html file:
<igx-radio-group [alignment]="alignment"> <igx-radio [(ngModel)]="selected" value="London">London</igx-radio> <igx-radio [(ngModel)]="selected" value="New York">New York</igx-radio> <igx-radio [(ngModel)]="selected" value="Tokyo">Tokyo</igx-radio> <igx-radio [(ngModel)]="selected" value="Sofia">Sofia</igx-radio></igx-radio-group>
I defined the properties "alignment" and "selected" like the following in my .ts file:
alignment: RadioGroupAlignment = RadioGroupAlignment.vertical; selected: string | undefined;
If I try to start the app i shows the following error in the console:
[error] Error: projects/.../test.component.html(11,1): Directive IgxRadioGroupDirective, Property 'vertical' is private and only accessible within class 'IgxRadioGroupDirective'.
If I use the radio-group without the alignment property, it shows the same error.
Does anybody know why this error is showing up or how I can fix this error?
Thanks in advanceRegards Michael
Hello Michael,
The decision for the scope of the properties is taken by our architects. You can submit a product idea/feature request on our GitHub page where you can explain the reason for this request, benefits of it, as well as be in direct communication with our engineers regardless such topics.
Regarding resolving the current issue, doesn't setting the alignment property used for binding to public fix it?
There are no errors caused by AOT compilation on it, so it should be all good.
Sincerely,
Tihomir TonevAssociate Software DeveloperInfragistics
Hi TihomirI checked out your sample and compared it with our project.In our case, we use the Infragistics component (including the IgxRadioGroupDirective) inside of a library and not directly in the app itself. But the configuration in the package.json and angular.json is nearly the same.If we use the "igx-radio-group" in an app, it works. If we use the "igx-radio-group" in an angular library, it does not work.
We looked into the IgxRadioGroupDirective and if we remove the private keyword for the vertical-property, the code works and we are able to use the "igx-radio-group" in our library.Otherwise it keeps throwing the error while building the lib:[error] Error: projects/.../test.component.html(11,1): Directive IgxRadioGroupDirective, Property 'vertical' is private and only accessible within class 'IgxRadioGroupDirective'.
Is there a specific reason why this property is private or are there any ways this property can be changed?Or are there any other things we need to take care of in order to use the "igx-radio-group" in components of a library?
Thanks
RegardsMichael
What I meant is to set the alignment property to public:
public alignment: RadioGroupAlignment = RadioGroupAlignment.vertical;
For further reference check the sample from our documentation here:
stackblitz.com/.../radio-group-vertical
Hello TihomirThanks for your reply.
The error I'm receiving is coming directly from the IgxRadioGroupDirective. Therefore I do not have the possibility to declare the property public by myself.
Regards
Michael
Thank you for posting on our forums.
For a given component all its members accessed by its template must be public when AOT compilation is used. In order to resolve the error you should either declare the properties public, or turn off AOT compilation.
Should you have any further questions, please let me know.
Sincerely,Tihomir TonevAssociate Software DeveloperInfragistics