Angular-cli: YESTERDAY'S RELEASE : Lot of error when build AOT

Created on 24 Mar 2017  路  18Comments  路  Source: angular/angular-cli

After updating (existing project, on windows10) :
CLI from rc2 to v1.0.0
Angular from rc4 to v4.0.0
Typescript to 2.2.1

Before yesterday's release, I never get errors when building using --prod but today my projects doesn't compile cause of private/protected members used in template!!! WHAT A MESS

https://gist.github.com/istiti/5b8e8c9db15135681f605b98e5a8e4f1

Wonder why this never happends before? how can I now search/replace all private/protected members used in template to public !

it's maybe stupid enhancement but is it possible that cli convert all members to public when runnin ng build ? or add a command to overwrite these propertys to public directly in project?

N.B: relativly big project

cc @hansl @filipesilva @Brocco @IgorMinar

Most helpful comment

@filipesilva please be nice. Your comment is in violation of our communication guidelines.

@istiti @Thieus @alastair-todd @bogdvn @hassanasad can one of you please open a new issue following the instructions in the issue template? We need all the info we can get to reproduce and confirm this issue before we can quickly fix it.

All 18 comments

+1 could someone please explain this behaviour?

1) for html templates to access their parent component's properties, what accessor level should these properties be (private is the gut feeling, the html + component class make up the component, I shouldnt have to make them public)?
2) why would the --prod flag change this behaviour?

+1
Beside this errors:

[disabled]="OnDsNotSelected()"
error: Supplied parameters do not match any signature of call target.

OnDsNotSelected(): boolean {
return this.options.length == 0;
}

Why i get this ?

Is there a way to solve this error with angular 2.4?

+1 Same error
Have you got a solution ?

ERROR in ....ngfactory.ts (696,41): Property 'clipPathId' does not exist on type 'BubbleChartComponent'.
ERROR in ....ngfactory.ts (207,35): Supplied parameters do not match any signature of call target.
ERROR in ....ngfactory.ts (642,48): Property 'onActivate' does not exist on type 'HeatMapComponent'.
ERROR in ....ngfactory.ts (646,48): Property 'onDeactivate' does not exist on type 'HeatMapComponent'.
ERROR in ....ngfactory.ts(342,44): Property 'labels' does not exist on type 'AdvancedPieChartComponent'.
ERROR in ....ngfactory.ts (300,67): Supplied parameters do not match any signature of call target.
ERROR in ....ngfactory.ts (131,7): Supplied parameters do not match any signature of call target.
ERROR in ....ngfactory.ts (870,44): Property '_selectedType' is private and only accessible within class 'SearchFormFlowDetailComponent'.
....ngfactory.ts (879,44): Property '_typesFlow' is private and only accessible within class 'SearchFormFlowDetailComponent'.

Could all these errors be related to TypeScript version 2.2.1 ?

User opened issue without bothering to fill in issue template, no repro or anything!!! WHAT A MESS

@filipesilva please be nice. Your comment is in violation of our communication guidelines.

@istiti @Thieus @alastair-todd @bogdvn @hassanasad can one of you please open a new issue following the instructions in the issue template? We need all the info we can get to reproduce and confirm this issue before we can quickly fix it.

Declare a private variable in a Component and access it in the html.

Then ng build with the --prod flag.

Nothing complicated but fairly major.

Issue is being tracked on this one https://github.com/angular/angular-cli/issues/5623
鈽濓笍 鈽濓笍 鈽濓笍

If someone is looking to migrate a bigger codebase: I've created hacked together a small macOS script that patches your codebase to make the required fields and methods (those actually used in at least one template) public. Currently only tested (and probably only works) on macOS because of sed vs GNU-sed specifics.

https://gist.github.com/netmikey/cb29ac391953f2c67aa102b28fd4fe16

I have resolved it with Angular 2.4.10, Angular-CLI 1.0.0-rc.2, and TypeScript 2.1.6

+1 for 1.0.0 but i dont have it on 1.0.0-beta.23.3

@netmikey your script sounds like it has the potential to save me a lot of time, but it doesn't seem to be working for me.

Are there any other workarounds for this issue?

I am getting this error with @angular/cli v1.3.1 / Typescript 2.4.2 / @angular/core v4.3.5 ng build works. ng build --prod throws lots of errors like
ERROR : Property 'providers' is private and only accessible
within class 'ProviderPickerComponent'.

Do we need to reopen this issue?

@oferns There is a changes was made with the angular cli from while ago.
the main problem is some variables are used inside the html and they are private in the component class
just remove the private key and everything will work fine.
I know this may be a huge problem specially with a big project "i felt that pain actually with my project xD" but sadly there is no other way to fix this.

@wnabil Thanks for the response. Basically, dont make private anything that the view/html needs to see? How come it doesnt fail in dev mode? thanks

@oferns as i understand before they was taking about this error will appear only when building the aot or the prod. generally just keep your variables public if you are using them inside the html.
you can serve your application with angular-cli as prod and aot "for testing and to help you with fixing the errors only" by running:
ng serve --prod --aot.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brtnshrdr picture brtnshrdr  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

naveedahmed1 picture naveedahmed1  路  3Comments

IngvarKofoed picture IngvarKofoed  路  3Comments

daBishMan picture daBishMan  路  3Comments