This article mainly introduces AngularJS getting started tutorial (2): AngularJS template. This is the third article in the series. This series will use a project to explain how to use AngularJS, for more information about the dynamic features of these webpages, see AngularJS! Here we have added a test for the Controller to be added later.
There are many types of code architectures for an application. For AngularJS applications, we encourage you to use the Model-View-controller (MVC) mode to decouple code and separate concerns. With this in mind, AngularJS is used to add models, views, and controllers for our applications.
Reset the working directory:
The Code is as follows:
Git checkout-f step-2
Our application now has a list of three mobile phones.
The most important differences between steps 1 and 2 are listed below. You can go to GitHub to see the complete difference.
Views and templates
In AngularJS, a view is the ing after the model is rendered using the HTML ** template. This means that, no matter when the model changes, AngularJS will update the combination point in real time and update the view accordingly.
For example, the view component is constructed by AngularJS using the following template:
The Code is as follows:
...