Home >Web Front-end >JS Tutorial >How to create your first AngularJS application_AngularJS
Follow the steps below to create an AngularJS application
Step 1: Load the frame
As a pure JavaScript framework, it can be added using the 3f1c4e4b6b16bbbd69b2ee476dc4f83a tag.
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"> </script>
Step 2: Define AngularJS application using ng-app directive
<div ng-app=""> ... </div>
Step 3: Pattern name defined with ng-model directive
<p>Enter your Name: <input type="text" ng-model="name"></p>
Step 4: Use the ng-bind directive to define the value binding in the above model
<p>Hello <span ng-bind="name"></span>!</p>
Follow the following steps to run the AngularJS application
Use the three steps mentioned above in your HTML page.
testAngularJS.html
<html> <title>AngularJS First Application</title> <body> <h1>Sample Application</h1> <div ng-app=""> <p>我的名字: <input type="text" ng-model="name"></p> <p>Hello, <span ng-bind="name"></span>!</p> </div> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script> </body> </html>
Output
Open textAngularJS.html in your web browser. Please enter your name and see the results.
How to integrate AngularJS with HTML