Angular2 - 'TypeError: str.replace is not a function' when using [disabled] #1451

Closed
opened 2025-08-09 17:20:12 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @baserz on 8/5/2016

Noticed that multiple [] tags do not work in the out of the box 'yo aspnetcore-spa' generated project.

For example by adding test: boolean = false; to counter.ts and then adding [disabled]="test" to the submit button in the html form. This generates the exception

Exception: Call to Node module failed with error: TypeError: str.replace is not a function
at escapeString (D:\Repos_Samples\YoNgSpa\node_modules\angular2-universal\node_modules\parse5\lib\serialization\serializer.js:27:10)

ONLY when directly using the url localhost:5000/counter. If using the routerlink to access the counter component it works.

Another issue is for example if adding the method test() { return false; } to the counter.ts and adding [style]="disabled: test()" to the submit button on the html form. This generates a

quotes are not supported for evaluation!

error originating from vendor.js

Unsure if this is an issue with Angular2 och with nodeservices but it seems to make these tags impossible to use.

*Originally created by @baserz on 8/5/2016* Noticed that multiple [] tags do not work in the out of the box 'yo aspnetcore-spa' generated project. For example by adding `test: boolean = false;` to counter.ts and then adding `[disabled]="test"` to the submit button in the html form. This generates the exception > Exception: Call to Node module failed with error: TypeError: str.replace is not a function > at escapeString (D:\Repos_Samples\YoNgSpa\node_modules\angular2-universal\node_modules\parse5\lib\serialization\serializer.js:27:10) ONLY when directly using the url localhost:5000/counter. If using the routerlink to access the counter component it works. Another issue is for example if adding the method `test() { return false; }` to the counter.ts and adding `[style]="disabled: test()"` to the submit button on the html form. This generates a > quotes are not supported for evaluation! error originating from vendor.js Unsure if this is an issue with Angular2 och with nodeservices but it seems to make these tags impossible to use.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1451
No description provided.