From bace531206ec2018d92c979159aa5f3311df2375 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Wed, 12 Nov 2014 20:58:59 +0100 Subject: [PATCH] docs(guide/expressions): clarify regexp literals usage in expressions Closes #10026 --- docs/content/guide/expression.ngdoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/content/guide/expression.ngdoc b/docs/content/guide/expression.ngdoc index 1280479b82e2..fbdf8f75cdb0 100644 --- a/docs/content/guide/expression.ngdoc +++ b/docs/content/guide/expression.ngdoc @@ -164,6 +164,12 @@ expression. The reason behind this is core to the Angular philosophy that applic be in controllers, not the views. If you need a real conditional, loop, or to throw from a view expression, delegate to a JavaScript method instead. +## No RegExp creation with literal notation + +You can't create regular expressions from within AngularJS expressions. This is to avoid complex +model transformation logic inside templates. Such logic is better placed in a controller or in a dedicated +filter where it can be tested properly. + ## `$event` Directives like {@link ng.directive:ngClick `ngClick`} and {@link ng.directive:ngFocus `ngFocus`}