diff --git a/projects/cdk/schematics/ng-update/v4/steps/templates/migrate-badged-content.ts b/projects/cdk/schematics/ng-update/v4/steps/templates/migrate-badged-content.ts index 57a7bb194ee4..d37decc6d132 100644 --- a/projects/cdk/schematics/ng-update/v4/steps/templates/migrate-badged-content.ts +++ b/projects/cdk/schematics/ng-update/v4/steps/templates/migrate-badged-content.ts @@ -3,7 +3,7 @@ import type {DevkitFileSystem} from 'ng-morph'; import type {Attribute, ElementLocation} from 'parse5/dist/common/token'; import {findElementsByTagName} from '../../../../utils/templates/elements'; -import {findAttr} from '../../../../utils/templates/inputs'; +import {findAttr, isBinding} from '../../../../utils/templates/inputs'; import { getTemplateFromTemplateResource, getTemplateOffset, @@ -120,13 +120,14 @@ function migrateColor({ const value = attr.value; const insertTo = sourceCodeLocation.startTag?.endOffset ?? 0; + const hasBinding = Boolean(attr) && isBinding(attr); recorder.insertRight( insertTo + templateOffset + 1, `\n`, ); } diff --git a/projects/cdk/schematics/ng-update/v4/tests/schematic-migrate-badged-content.spec.ts b/projects/cdk/schematics/ng-update/v4/tests/schematic-migrate-badged-content.spec.ts index 6ab06ad640e3..b7df1e0987b8 100644 --- a/projects/cdk/schematics/ng-update/v4/tests/schematic-migrate-badged-content.spec.ts +++ b/projects/cdk/schematics/ng-update/v4/tests/schematic-migrate-badged-content.spec.ts @@ -43,6 +43,9 @@ const TEMPLATE_BEFORE = ` {{ day?.activity?.date?.day }}

+ +

{{ day?.activity?.date?.day }}

+ + +