Need to find which Angular template is causing an error

Discussão em 'Angular' iniciado por David Emami, Outubro 2, 2024.

  1. David Emami

    David Emami Guest

    I'm in the process of upgrading an app from Angular 8.x to 9.x (first step towards upgrading to latest), using ng update. After the update, I'm seeing the following when starting the app:

    [ng] ERROR in Error: Cannot assign value "$event" to template variable "option". Template variables are read-only.
    [ng] at _AstToIrVisitor.visitPropertyWrite (/Users/demami/Projects/claimocity-mobile/mobile-ui/node_modules/@angular/compiler/bundles/compiler.umd.js:8923:31)
    [ng] at PropertyWrite.visit (/Users/demami/Projects/claimocity-mobile/mobile-ui/node_modules/@angular/compiler/bundles/compiler.umd.js:7795:28)
    [ng] at convertActionBinding (/Users/demami/Projects/claimocity-mobile/mobile-ui/node_modules/@angular/compiler/bundles/compiler.umd.js:8524:49)
    [ng] at prepareEventListenerParameters (/Users/demami/Projects/claimocity-mobile/mobile-ui/node_modules/@angular/compiler/bundles/compiler.umd.js:17703:27)
    [ng] at Object.params (/Users/demami/Projects/claimocity-mobile/mobile-ui/node_modules/@angular/compiler/bundles/compiler.umd.js:18828:24)
    [ng] at /Users/demami/Projects/claimocity-mobile/mobile-ui/node_modules/@angular/compiler/bundles/compiler.umd.js:18599:94
    [ng] at Array.map (<anonymous>)
    [ng] at /Users/demami/Projects/claimocity-mobile/mobile-ui/node_modules/@angular/compiler/bundles/compiler.umd.js:18599:60
    [ng] at /Users/demami/Projects/claimocity-mobile/mobile-ui/node_modules/@angular/compiler/bundles/compiler.umd.js:17860:87
    [ng] at Array.map (<anonymous>)
    [ng] at TemplateDefinitionBuilder.buildTemplateFunction (/Users/demami/Projects/claimocity-mobile/mobile-ui/node_modules/@angular/compiler/bundles/compiler.umd.js:17860:60)
    [ng] at /Users/demami/Projects/claimocity-mobile/mobile-ui/node_modules/@angular/compiler/bundles/compiler.umd.js:18401:60
    [ng] at /Users/demami/Projects/claimocity-mobile/mobile-ui/node_modules/@angular/compiler/bundles/compiler.umd.js:17838:81
    [ng] at Array.forEach (<anonymous>)
    [ng] at TemplateDefinitionBuilder.buildTemplateFunction (/Users/demami/Projects/claimocity-mobile/mobile-ui/node_modules/@angular/compiler/bundles/compiler.umd.js:17838:37)
    [ng] at /Users/demami/Projects/claimocity-mobile/mobile-ui/node_modules/@angular/compiler/bundles/compiler.umd.js:18401:60


    I've search through the templates and found and fixed other places assigning to template variables, but can't find the one causing this error. Is there a way to find the specific template file causing this error?

    In case it matters, I'm serving using ionic serve rather than ng serve.

    Thank you in advance for any help.

    Continue reading...

Compartilhe esta Página