Closed tklein243 closed 4 years ago
Same happened to me since updating to nativescript-ui-chart 7.0.0. A workaround for me was to use visibility
instead of ngIf
In your case it will give something like this
<GridLayout rows="*, *" [visibility]="favoriteFruits ? 'visible' : 'collapse'">
<RadCartesianChart row="0" id="cartesianChart" style="height: 100%">
<CategoricalAxis tkCartesianHorizontalAxis labelSize="40"
labelMargin="10"></CategoricalAxis>
<LinearAxis tkCartesianVerticalAxis></LinearAxis>
<BarSeries tkCartesianSeries [items]="favoriteFruits"
categoryProperty="type" valueProperty="count" seriesName="Bar">
</BarSeries>
<Palette tkCartesianPalette seriesName="Bar">
<PaletteEntry tkCartesianPaletteEntry fillColor="#db5560"
strokeColor="#bb1616"></PaletteEntry>
</Palette>
</RadCartesianChart>
</GridLayout>
I am having the same problem with angular implementation. I put the chart around an ngFor and produced the same error.
I solved this problem by returning from version 7.1.1 to 6.0.0 of the nativescript-ui-chart plugin. Then I made npm dedupe to eliminate duplicate references. This works for me.
If you do not need complement support with the dark mode of iOS or Android, then it may work for you too.
I will wait for them to implement the fix proposed by @ashvinders here (by the way it worked for me too).
+1
Guys, you can't use ANgular structural directives for a native mobile component at least not in this case. The Angular is the top abstraction and is rendering its visual tree on top of the NativeSciprt and the mobile layers. SO when using structural directives from the top layer to manipulate native mobile components from the bottom layer it could cause some side effects.
Hi Nick,
I don't agree with your statement that a native script component cannot use angular structural directives. If your platform claims to allow developers to use angular in a native mobile application then ngif and ngfor are basic angular fundamentals, they need to be supported. If not now then in subsequent release. Simply stating it doesn't and closing the issue seems unreasonable to me.
Cheers, Ash
On Thu, 6 Feb. 2020, 11:11 pm Nick Iliev, notifications@github.com wrote:
Guys, you can't use ANgular structural directives for a native mobile component at least not in this case. The Angular is the top abstraction and is rendering its visual tree on top of the NativeSciprt and the mobile layers. SO when using structural directives from the top layer to manipulate native mobile components from the bottom layer it could cause some side effects.
β You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NativeScript/nativescript-ui-feedback/issues/1332?email_source=notifications&email_token=AMSKHYWFS5KJURHBXFG4HTDRBP46VA5CNFSM4KHFND2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEK677AI#issuecomment-582877057, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMSKHYTJBNCCXLPEU42FUNTRBP46VANCNFSM4KHFND2A .
@ashvinders the framework is open-sourced and we are accepting any community-driven features and enhancements. Feel free to join the contributors and implement the full support for Angular structural directives in the context of chart, listview, and/or any other mobile components.
Here are some sources related to the requirements and the workflow for contributors:
https://www.nativescript.org/contribute https://www.nativescript.org/community https://www.nativescript.org/blog/nativescript-first-time-contribution-contest-continued-and-extended
I would love to contribute to the chart code base however I was unable to locate it on GitHUB or find any links to it. I've already established which line is causing the issue in which source file and I am happy create a pull request for review if you are able to let me know where the repository is.
On Mon, Feb 10, 2020 at 8:03 PM Nick Iliev notifications@github.com wrote:
@ashvinders https://github.com/ashvinders the framework is open-sourced and we are accepting any community-driven features and enhancements. Feel free to join the contributors and implement the full support for Angular structural directives in the context of chart, listview, and/or any other mobile components.
Here are some sources related to the requirements and the workflow for contributors:
https://www.nativescript.org/contribute https://www.nativescript.org/community
β You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NativeScript/nativescript-ui-feedback/issues/1332?email_source=notifications&email_token=AMSKHYWBG3Y5CPOOCOMQSRDRCEJ55A5CNFSM4KHFND2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELHXKVI#issuecomment-584021333, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMSKHYX7TOL2H53MIWWPEHTRCEJ55ANCNFSM4KHFND2A .
+1
+1
+1 Any updates ?
+1
When charts are wrapped in an ngIf they throw an ERROR TypeError: Cannot read property '_ngKey' of undefined error.
component.tns.ts
component.tns.html