Move normalizeTemplateAttributes method to DirectiveParser

This commit is contained in:
Kim Biesbjerg 2016-12-23 04:07:01 +01:00
parent 91dc1925a1
commit d0730431d0
2 changed files with 9 additions and 9 deletions

View File

@ -20,13 +20,4 @@ export abstract class AbstractTemplateParser {
return '';
}
/**
* Angular's `[attr]="'val'"` syntax is not valid HTML,
* so it can't be parsed by standard HTML parsers.
* This method replaces `[attr]="'val'""` with `attr="val"`
*/
protected _normalizeTemplateAttributes(template: string): string {
return template.replace(/\[([^\]]+)\]="'([^']*)'"/g, '$1="$2"');
}
}

View File

@ -43,4 +43,13 @@ export class DirectiveParser extends AbstractTemplateParser implements ParserInt
return collection;
}
/**
* Angular's `[attr]="'val'"` syntax is not valid HTML,
* so it can't be parsed by standard HTML parsers.
* This method replaces `[attr]="'val'""` with `attr="val"`
*/
protected _normalizeTemplateAttributes(template: string): string {
return template.replace(/\[([^\]]+)\]="'([^']*)'"/g, '$1="$2"');
}
}