I encountered a peculiar issue with my Angular 5 app. Everything runs smoothly in test mode when using the ng serve
command locally. However, upon deploying the application in production mode with the ng build --prod
command, an unforeseen problem arises when accessing the app in a live environment as shown by these browser console screenshots from Google Chrome and Safari:
Google Chrome Console:
https://i.sstatic.net/dSeK1.png
Safari Console:
https://i.sstatic.net/OPUaV.png
Let's delve into the component associated with the mentioned error:
user-online-quote.component.html
<app-navbar [loggedIn]=loggedIn></app-navbar>
<app-dynamic-form [answers$]="answers$"></app-dynamic-form>
user-online-quote.component.ts
import { Component, OnInit } from '@angular/core';
import { DynamicFormService } from '../_services/dynamic-form.service';
import { RadioQuestion } from '../shared/_shared/answer-radio';
import { Observable } from "rxjs/Rx";
import { AuthService } from '../_services/auth.service';
... (truncated for brevity) ...
@Component({
selector: 'app-user-online-quote',
templateUrl: './user-online-quote.component.html',
styleUrls: ['./user-online-quote.component.css'],
providers: [DynamicFormService]
})
export class UserOnlineQuoteComponent implements OnInit {
totalPage:number;
actualPage:number;
percentageCompletion:number;
... (more details omitted) ...
}
dinamic-form.component.html
<div class="space"></div>
<ngx-loading [show]="loading" [config]="{ backdropBorderRadius: '0px', fullScreenBackdrop:true }"></ngx-loading>
... (omitted code snippet) ...
dinamic-form.component.ts
import { Component, Input, OnInit, ChangeDetectorRef } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { AnswerBase } from '../shared/_shared/answer-base';
import { AnswerControlService } from '../_services/answer-control.service';
... (continue with truncated content)...
package.json
{
"name": "front-end",
... (other dependencies listed) ...
}
The anomalous occurrence of this error only post-exporting the application raises curiosity. It comes as a surprise, especially considering no errors or warnings appear during the export process completion. Any suggestions on deciphering this strange behavior?