victorantos / AngJobs

Job board for hackers
https://angjobs.com
75 stars 33 forks source link

Angular app fails build prod #60

Closed mightyhorst closed 7 months ago

mightyhorst commented 5 years ago

When transpiling the Angular app using ng build "--prod"

You get the following compile errors

ERROR in src/app/app.component.html(103,33): : Operator '===' cannot be applied to types 'string[]' and 'string'.
src/app/app.component.html(104,23): : Operator '===' cannot be applied to types 'string[]' and 'string'.
src/app/app.component.html(106,17): : Operator '===' cannot be applied to types 'string[]' and 'string'.
src/app/app.component.html(107,20): : Operator '===' cannot be applied to types 'string[]' and 'string'.
src/app/app.component.html(108,32): : Operator '===' cannot be applied to types 'string[]' and 'string'.
src/app/jobs/jobs.component.html(3,18): : Property 'addnewJob' does not exist on type 'JobsComponent'.
src/app/jobs/job-detail/job-detail.component.html(4,24): : Expected 0 arguments, but got 1.
src/app/jobs/job-detail/job-detail.component.html(41,32): : Expected 0 arguments, but got 1.
src/app/shared/editarea.component.ts.EditareaComponent.html(1,13): : Expected 0 arguments, but got 1.
mightyhorst commented 5 years ago

I'll create a pull request later on but here's the quick fix... you may be in middle of this, but anyway for other developers:

1. loadedFeature can be set to either string|string[]

Error:

ERROR in src/app/app.component.html(103,33): : Operator '===' cannot be applied to types 'string[]' and 'string'.
src/app/app.component.html(104,23): : Operator '===' cannot be applied to types 'string[]' and 'string'.
src/app/app.component.html(106,17): : Operator '===' cannot be applied to types 'string[]' and 'string'.
src/app/app.component.html(107,20): : Operator '===' cannot be applied to types 'string[]' and 'string'.
src/app/app.component.html(108,32): : Operator '===' cannot be applied to types 'string[]' and 'string'.

Fix In strict mode you cant compare an array of strings to a string. simple fix: loadedFeature: string|string[] = ["job"];

2. add a variable addnewJob to JobsComponent

Error:

src/app/jobs/jobs.component.html(3,18): : Property 'addnewJob' does not exist on type 'JobsComponent'.

Fix: I think this is a flag?

if so addnewJob:boolean = true;

3. onClose() needs to accept an argument

Error:

src/app/jobs/job-detail/job-detail.component.html(4,24): : Expected 0 arguments, but got 1.
src/app/jobs/job-detail/job-detail.component.html(41,32): : Expected 0 arguments, but got 1.

Fix: onClose(evt) in job-detail.component

and same with EditareaComponent