diff --git a/src/lib/schematics/update/html/angular.ts b/src/lib/schematics/update/html/angular.ts index c7ed1f5f801..6823f229674 100644 --- a/src/lib/schematics/update/html/angular.ts +++ b/src/lib/schematics/update/html/angular.ts @@ -10,10 +10,26 @@ import {findAttributeOnElementWithAttrs, findAttributeOnElementWithTag} from './ /** Finds the specified Angular @Input in the given elements with tag name. */ export function findInputsOnElementWithTag(html: string, inputName: string, tagNames: string[]) { - // Add one column to the mapped offset because the first bracket for the @Input - // is part of the attribute and therefore also part of the offset. We only want to return - // the offset for the inner name of the input. - return findAttributeOnElementWithTag(html, `[${inputName}]`, tagNames).map(offset => offset + 1); + return [ + // Inputs can be also used without brackets (e.g. ``) + ...findAttributeOnElementWithTag(html, inputName, tagNames), + // Add one column to the mapped offset because the first bracket for the @Input + // is part of the attribute and therefore also part of the offset. We only want to return + // the offset for the inner name of the bracketed input. + ...findAttributeOnElementWithTag(html, `[${inputName}]`, tagNames).map(offset => offset + 1), + ]; +} + +/** Finds the specified Angular @Input in elements that have one of the specified attributes. */ +export function findInputsOnElementWithAttr(html: string, inputName: string, attrs: string[]) { + return [ + // Inputs can be also used without brackets (e.g. `