开发者

ERROR, ANGULAR 14, My application gets up and updates itself in loop

开发者 https://www.devze.com 2022-12-07 21:37 出处:网络
ERROR, ANGULAR 14, My application gets up and updates itself in loop. When lifting the service with ng serve --hmr --the application runs and enters the loop, the page is updated infinitely, I don\'t

ERROR, ANGULAR 14, My application gets up and updates itself in loop.

When lifting the service with ng serve --hmr --the application runs and enters the loop, the page is updated infinitely, I don't have any service that is updating the page.

Which library would the configuration be causing?

angular.json

{
    "name": "frontend",
    "version": "0.0.0",
    "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build",
        "watch": "ng build --watch --configuration development",
        "test": "ng test"
    },
    "private": true,
    "dependencies": {
        "@angular/animations": "^14.2.0",
        "@angular/cdk": "^14.2.7",
        "@angular/common": "^14.2.0",
        "@angular/compiler": "^14.2.0",
        "@angular/core": "^14.2.0",
        "@angular/forms": "^14.2.0",
        "@angular/material": "^14.2.7",
        "@angular/platform-browser": "^14.2.0",
        "@angular/platform-browser-dynamic": "^14.2.0",
        "@angular/router": "^14.2.0",
        "@angular/service-worker": "^14.2.0",
        "@fortawesome/fontawesome-free": "^6.0.0",
        "@ngrx/effects": "^14.3.2",
        "@ngrx/entity": "^14.3.2&开发者_Go百科quot;,
        "@ngrx/store": "^14.3.2",
        "@ngrx/store-devtools": "^14.3.2",
        "angular-calendar": "^0.29.0",
        "bootstrap": "^5.0.1",
        "chart.js": "^2.5.0",
        "date-fns": "^2.23.0",
        "easy-pie-chart": "2.1.x",
        "hammerjs": "^2.0.8",
        "ng-uikit-pro-standard": "file:ng-uikit-pro-standard-14.0.0.tgz",
        "rxjs": "~7.5.0",
        "screenfull": "3.3.x",
        "tslib": "^2.3.0",
        "zone.js": "~0.11.4"
    },
    "devDependencies": {
        "@angular-devkit/build-angular": "^14.2.8",
        "@angular/cli": "~14.2.8",
        "@angular/compiler-cli": "^14.2.0",
        "@types/jasmine": "~4.0.0",
        "jasmine-core": "~4.3.0",
        "karma": "~6.4.0",
        "karma-chrome-launcher": "~3.1.0",
        "karma-coverage": "~2.2.0",
        "karma-jasmine": "~5.1.0",
        "karma-jasmine-html-reporter": "~2.0.0",
        "typescript": "~4.7.2"
    }
}

app.module.ts



`import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ErrorStateMatcher } from '@angular/material/core';
import { DefaultErrorMatcher } from './core/shared/default.error-matcher';
import { AuthService } from './modules/auth/services/auth.service';
import { authInterceptorProviders } from './core/interceptors/http.interceptor';

@NgModule({
    declarations: [AppComponent],
    imports: [
        BrowserModule,
        AppRoutingModule,
        HttpClientModule,
        StoreModule.forRoot({}, {}),
        EffectsModule.forRoot([]),
        StoreDevtoolsModule.instrument({
            maxAge: 25,
            logOnly: environment.production
        }),
        BrowserAnimationsModule,
        ServiceWorkerModule.register('ngsw-worker.js', {
            enabled: environment.production,
            registrationStrategy: 'registerWhenStable:30000'
        })
    ],
    // providers: [AuthERPService, { provide: ErrorStateMatcher, useClass: DefaultErrorMatcher }],
    providers: [
        AuthService,
        authInterceptorProviders,
        { provide: ErrorStateMatcher, useClass: DefaultErrorMatcher }
    ],

    bootstrap: [AppComponent]

})
export class AppModule {}
`

main.ts

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
    console.log('environment', environment.production);

    enableProdMode();
}

platformBrowserDynamic()
    .bootstrapModule(AppModule)
    .catch((err) => console.error(err));

0

精彩评论

暂无评论...
验证码 换一张
取 消