Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
296 views
in Technique[技术] by (71.8m points)

Problem facing with ng-pattern for html text validation

I have a field defined in configuration file in backend as :

'pattern' : '/^[a-zA-Z. ]+$/'

and I am accessing this pattern as

ng-pattern = "{{field.pattern}}"

in the html. But the pattern is not working, I have debugged and verified the value of pattern it is pattern: "/^[a-zA-Z. ]+$/" on front end, if I replace ng-pattern with :

ng-pattern= "/^[a-zA-Z. ]+$/"

Then everything works fine . Why it is that and how to pick the pattern which is defined in the backend config , so that

ng-pattern = "{{field.pattern}}"

this expression works in html. Thank you


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...