Introduction to AngularJs
AngularJs is a JavaScript framework, it is a library written in JavaScript
Need to import files Like jQuery, you can import online or download local files
ng-app is to tell this is an AngularJs application
ng-model binds element values to applications.
ng-bind binds application data to html views
<div of-init = "firstName = ''" of-app = ''> <p>姓名:<input type="text" ng-model="firstName" ></p> <p>名字{{ firstName }}</p> //In this way, the name we enter in the input box will be displayed in the P tag of the name //ng-app is to tell angularjs that this is an angular control
If your entire html file is written in angularjs, then you can use an ng-app to
write the ng-app in the body
<body ng-app" ">
This means that this page is all angular
You can also write operations in expressions {{ }}
{{ 5*6 }}
ng-init is initialization, that is, what is displayed at the beginning
<div ng-init="qty=1;cost=2"><!--The value inside is what is displayed during initialization--> <b>Orders:</b> <div> 数量: <input type="number" ng-model="qty" required > </div> <div> 单价: <input type="number" ng-model="cost" required > </div> <div> <b>Total price:{{ qty * cost}}</b> </div> </div>
When initialized, the quantity is 1 and the unit price is 2
If you are getting a mailbox to log in, you need to verify whether it is in the correct mailbox format and need an ng-show
<span ng-show="myForm.myAddress.$error.email">Not a valid email address</span>
It will judge whether your input is correct according to the value in ng-show