AngularJS is used to build single page applications, meaning that all of your code runs on the client side of the browser instead of being downloaded from the server and executed there. This makes it faster than traditional web applications because it doesn’t have to download anything over the wire; all data is stored locally on each user’s device (or at least in memory).
AngularJS uses the MVC pattern: Model View Controller (MVC). The Model contains the business logic of your application, while the View represents how it looks onscreen. The Controller handles data requests from the server or user input that changes state in your application’s logic and passes them on to appropriate parts of your app’s view for processing.
To create an Angular application, you need to include the Angular library in your HTML page
To create an Angular application, you need to include the Angular library in your HTML page. You can add the AngularJS library to your HTML page by using two methods:
- Add Scripts using an AJAX request (the most common method) or
The ng-app directive defines an AngularJS application
The ng-app directive is used to define an AngularJS application. It can be used with a selector or an HTML element, and it can also be used as the first element in your HTML template.
The ng-app directive has several attributes:
- ngModel – This attribute defines what data binds to the form fields. You may use either an expression or a string value for this parameter. If you want your data binding to work only when submitted by some kind of user input (e.g., when creating a new record), then go ahead and use ‘name’ here; otherwise leave it blank since we’ll get into more details later on how to add validation rules later on too!
- scope – This attribute specifies which scope should be used by this component/module so that other things like controllers, directives etc., don’t interfere with each other’s actions/behaviors (which could happen if everything else works fine but we have no mechanism for passing information around within our app).”
The ng-model directive binds the value of HTML controls to application data
The ng-model directive binds the value of HTML controls to application data. This is useful for two-way data binding, where you can assign an HTML element’s value to a property in your AngularJS controller (or any other component). You can also use it with any HTML element that supports the value attribute, such as input, textarea and select.
The following code example shows how to use ngModel in order to bind an input field’s content to a property on our route object:
Bind some properties within this controller by using `ngModel` directives anywhere there are *Input* elements on those pages – either inside templates or outside them! You can also specify which values you want by supplying attributes like `required` versus `optional`.