Angular: RegExp Literal in template expression parse error

Created on 12 Jan 2016  路  3Comments  路  Source: angular/angular

<div *ng-if="myStringVar.match(/regexp/)">myStringVar had 'regexp' in it! </div>` 

produces

EXCEPTION: Template parse errors:
Parser Error: Unexpected token / at column 25 in [ng-if myStringVar.match(/regexp/)] in function () {
 > div:nth-child(0)[*ng-if=myStringVar.match(/regexp/)]

in Chrome on Angular 2.0.0-alpha.46

Plunkr

core obvious

Most helpful comment

...why?

All 3 comments

RegExp literal are not supported by the templating language.

They should be on your component.

...why?

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings