How to add password validation using regular expression in angularjs according to certain criterion?

As far as i understood your problem. Check your console It might be broken on lexical errors.

You forgot slash at start and at end of ng-pattern. Please use ng-pattern="/^(?=.*[A-Za-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{8,}$/"

I have created a plunk which might help you.

Just a couple notes

1) The above contains one redundant $. It should be ng-pattern="/^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/"

2) Don't remove leading ^ and trailing $ as it prevents from entering white spaces

3) If you want to define the pattern in controller then

$scope.passwordStrength = /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/; and <input ng-pattern="passwordStrength">

but never

$scope.passwordStrength = "/^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/";

as the pattern is a RegExp object, not a string.

Hope this will help you save some time.