Angular. js is a front-end development framework designed and developed by google developers, helping you simplify the burden of front-end development. To what extent can it be simplified? Today, let's take a look at a line of code to implement the control Verification effect. How scared is there?
As shown in, we need to implement the following verification functions:
All controls are mandatory controls.
The maximum length must be controlled.
When the page is opened for the first time, the control cannot be displayed as an error
After the input content is cleared, the mandatory control must be displayed as an error.
The publish button is available only after all input values are valid.
Through AngularJS, we can easily implement these requirements, requiring only one line of JS Code. The UI style uses Bootstrap. First, the sample code is as follows:
HTML.
Demo