Remove baskslash in pattern attribute
See original GitHub issueHi,
It seems that the plugin remove backslash in pattern attributes when inlining the template.
Before :
<input type="text" [(ngModel)]="search.imei" id="form-imei" class="form-control" pattern="\d+" required />
After :
<input type="text" [(ngModel)]="search.imei" id="form-imei" class="form-control" pattern="d+" required />
Thanks in advance
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
How to remove a text followed by backslash in file using sed ...
This will act on lines which contain the <base pattern, and replace the pattern href="/any text up to the double quote with href="/...
Read more >Learning About Regular Expressions - L3HarrisGeospatial.com
The backslash suppresses the special meaning of the character it precedes, and turns it into an ordinary character. To insert a backslash into...
Read more >Regex support for pattern attribute · Issue #132 - GitHub
Current behavior: I use angularjs, and some inputs has ng-pattern attribute. html-loader remove backslashes in regex inside this attribute and ...
Read more >HTML attribute: pattern - HTML: HyperText Markup Language
The pattern attribute specifies a regular expression the form control's ... No forward slashes should be specified around the pattern text.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This still appears to be an issue. I’ve recently updated from Angular2 RC5 to Final and accomplished that by merging the latest seed changes. My lazy solution has been to run with pattern with a single \ in dev but when I’m happy with its functionality I go through and replace with \ -> \ and then it works fine in production.
It seems like this is a general issue @ludohenin where backslashes in html/css files need to be escaped for when they are placed into string literals in JavaScript.
JavaScript would interpret the string literal
"\d"
in code to simply be the stringd
.We basically need to convert this html:
To the following JavaScript:
Which will ultimately form this string in memory:
<input pattern="\d+">