angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

YESTERDAY'S RELEASE : Lot of error when build AOT

Open elvisbegovic opened this issue 9 years ago • 18 comments

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

elvisbegovic avatar Mar 24 '17 10:03 elvisbegovic

+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?

alastair-todd avatar Mar 24 '17 11:03 alastair-todd

+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 ?

bogdvn avatar Mar 24 '17 11:03 bogdvn

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

stavn1 avatar Mar 24 '17 12:03 stavn1

+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'.

Thieus avatar Mar 24 '17 13:03 Thieus

Could all these errors be related to TypeScript version 2.2.1 ?

hassanasad avatar Mar 24 '17 15:03 hassanasad

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

filipesilva avatar Mar 24 '17 15:03 filipesilva

@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.

IgorMinar avatar Mar 24 '17 15:03 IgorMinar

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.

alastair-todd avatar Mar 24 '17 16:03 alastair-todd

Issue is being tracked on this one https://github.com/angular/angular-cli/issues/5623 ☝️ ☝️ ☝️

sumitarora avatar Mar 24 '17 16:03 sumitarora

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

netmikey avatar Mar 28 '17 12:03 netmikey

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

pcgeng avatar Apr 07 '17 06:04 pcgeng

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

wnabil avatar Apr 09 '17 14:04 wnabil

@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?

kblestarge avatar Apr 25 '17 22:04 kblestarge

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 avatar Aug 20 '17 19:08 oferns

@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 avatar Aug 21 '17 11:08 wnabil

@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 avatar Aug 21 '17 11:08 oferns

@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.

wnabil avatar Aug 21 '17 12:08 wnabil

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.