0

I would like to add beginsWith (^=) and endsWith ($=).

E.g., scope.$eval('"abcd" ^= "a"') should return 'true'

1

1 Answer 1

1

According to Angular's documentation on expressions, you should use controller\filter:

No function declarations or RegExp creation with literal notation

You can't declare functions or 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.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks. It seems that AngularJS expressions are not open for such extensions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.