.html
<offline-picks *ngFor="let pick of pickData" [data]="pick"></offline-picks>
.ts
export class OfflineArticlesPage {
private pickData: picksModel[] = [];
constructor(private localCacheService: LocalCacheServiceProvider) {
}
}
When I used the private member
as shown above it shows below error.I'm using Angular Language Service extension on VS code
editor.
[Angular] Identifier 'pickData' refers to a private member of the component
Hope using private members
inside the component is good programming practice no? But as a solution for above issue was given as below comment on the extension's repo.
The language service will emit these errors because they will be errors during AOT. Eventually, you will need to resolve these.
We have plans to support access to private and protected members in AOT but that will not land until at least 6.0 (spring of next year).
So can you tell me what will be the best way to declare members on the components?
Update:
I use ionic cordova run android --prod --device
CLI command with latest Ionic "ionic-angular": "3.5.3",
.But it works nicely on my Android device.That means it is working fine with the AOT
too no? Then why this error (or warning actually)?
They have to be public
in order for AoT
to work.
See here for a bit more details: https://github.com/angular/angular/issues/11978