[英]Identifier refers to a private member of the component
.html html的
<offline-picks *ngFor="let pick of pickData" [data]="pick"></offline-picks>
.ts .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. 当我使用如上所示的
private member
,它显示以下错误。我在VS code
编辑器上使用Angular Language Service扩展。
[Angular] Identifier 'pickData' refers to a private member of the component
[Angular]标识符'pickData'指的是组件的私有成员
Hope using private members
inside the component is good programming practice no? 希望在组件内部使用
private members
是不是很好的编程习惯? 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.
语言服务将发出这些错误,因为它们在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).
我们计划支持AOT中私人和受保护成员的访问,但至少在6.0(明年春天)之前不会降落。
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? 我使用
ionic cordova run android --prod --device
CLI命令与最新的离子"ionic-angular": "3.5.3",
但它在我的Android设备上运行良好。这意味着它与AOT
工作正常也没有? Then why this error (or warning actually)? 那为什么会出现这个错误(或实际警告)?
They have to be public
in order for AoT
to work. 他们必须
public
才能让AoT
工作。
See here for a bit more details: https://github.com/angular/angular/issues/11978 有关详细信息,请参阅此处: https : //github.com/angular/angular/issues/11978
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.