Home Web Front-end JS Tutorial angularjs basic tutorial_AngularJS

angularjs basic tutorial_AngularJS

May 16, 2016 pm 04:24 PM
angularjs Basic tutorial

I haven’t written anything for a long time. I feel like I don’t even know where to start. Let’s write something technical first, angularjs – my brother calls it “忺哥拉js”

1. Download

Copy code The code is as follows:

Official website: <a href="https://angularjs.org/">https://angularjs.org/<code>官方网址:<a href="https://angularjs.org/">https://angularjs.org/</a>
CDN: <a href="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.5/angular.min.js">https://ajax.googleapis.com /ajax/libs/angularjs/1.3.0-beta.5/angular.min.js<code>CDN:<a href="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.5/angular.min.js">https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.5/angular.min.js</a>

2. Brief introduction to use 1.ng-app

determines the scope of angularjs, you can use it as follows

Copy code The code is as follows:


… 

to let angularjs render the entire page, you can also use

Copy code The code is as follows:
<code><br> <font face="Arial"><div ng-app='myapp'><br> ……<br> </div></font><br>

to render part of it.

2.ng-model

ng-model, when your data model is changed, for example, ng-model='test', when the value of test is changed, the value of {{test}} will also change accordingly, that is The test connected to ng-model has also changed, as follows Copy code

The code is as follows:





          
& Lt; title & gt; learing argularjs-widuu & lt;/title & gt;


{{test}}

3.angular.module

This is mainly used for module registration, creation and indexing. For example, if our ng-app wants to register this as a service, we must use it. We also need to use it when we reference and index a module. Copy code

The code is as follows:


angular.module(name, [requires], [configFn]);
#name The name of the retrieval module created by type string
#requires A simple understanding is that you need to include the usage module, such as ngRoute routing module #configFn Optional function module, the function is similar to module.config

4.controller

Controller is the method controller(name, constructor) in angular.Module; where name is the name of the controller and constructor is the controller constructor. We use a piece of code to illustrate Copy code
The code is as follows:




          
         
         
       
        learing argularjs--widuu
   
   
    {{test}}
   


        {{output}}
   

6.provider

provider也是angular.Module中的方法provider(name, providerType);其中name是service的名称,providerFunction是函数用于创建新的服务器对象,这个跟factory差不多,我们现在用provider重写

复制代码 代码如下:



   
       
       
        learing argularjs--widuu
   
   
    {{test}}
   


        {{output}}
   

7.service

service也是angular.Module中的方法service(name, constructor);其中name是service的名称,constructor一个将被实例化的构造函数,这个跟factory差不多,我们现在用service重写

复制代码 代码如下:



   
       
       
        learing argularjs--widuu
   
   
    {{test}}
   


        {{output}}
   

8.constant

constant也是angular.Module中的方法constant(name, object);其中name是常量的名称,而object是常量的值,我们可以这样写的

复制代码 代码如下:



   
       
       
        learing argularjs--widuu
   
   
    {{test}}
   


        {{output}}
   

今天就写到这里,然后以后继续.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The latest 5 angularjs tutorials in 2022, from entry to mastery The latest 5 angularjs tutorials in 2022, from entry to mastery Jun 15, 2017 pm 05:50 PM

Javascript is a very unique language. It is unique in terms of the organization of the code, the programming paradigm of the code, and the object-oriented theory. The issue of whether Javascript is an object-oriented language that has been debated for a long time has obviously been There is an answer. However, even though Javascript has been dominant for twenty years, if you want to understand popular frameworks such as jQuery, Angularjs, and even React, just watch the "Black Horse Cloud Classroom JavaScript Advanced Framework Design Video Tutorial".

Use PHP and AngularJS to build a responsive website to provide a high-quality user experience Use PHP and AngularJS to build a responsive website to provide a high-quality user experience Jun 27, 2023 pm 07:37 PM

In today's information age, websites have become an important tool for people to obtain information and communicate. A responsive website can adapt to various devices and provide users with a high-quality experience, which has become a hot spot in modern website development. This article will introduce how to use PHP and AngularJS to build a responsive website to provide a high-quality user experience. Introduction to PHP PHP is an open source server-side programming language ideal for web development. PHP has many advantages, such as easy to learn, cross-platform, rich tool library, development efficiency

VUE3 basic tutorial: implementing common functions VUE3 basic tutorial: implementing common functions Jun 16, 2023 am 08:16 AM

Vue3 is the latest version of Vue.js released recently. Vue3 provides many new features and optimizations, such as a new responsive system, better type support and performance improvements, making it more efficient and easier to use. This article will introduce basic tutorials for implementing common functions in Vue3. The following is the implementation of three basic functions: 1. Responsive data Vue3 redesigns the responsive system and uses Proxy objects to implement responsive data. Compared with Vue2’s defineProperty, Proxy can

Build web applications using PHP and AngularJS Build web applications using PHP and AngularJS May 27, 2023 pm 08:10 PM

With the continuous development of the Internet, Web applications have become an important part of enterprise information construction and a necessary means of modernization work. In order to make web applications easy to develop, maintain and expand, developers need to choose a technical framework and programming language that suits their development needs. PHP and AngularJS are two very popular web development technologies. They are server-side and client-side solutions respectively. Their combined use can greatly improve the development efficiency and user experience of web applications. Advantages of PHPPHP

Basic tutorial on using excel Basic tutorial on using excel Mar 20, 2024 pm 01:00 PM

For most office workers, sometimes less than 10% of the functions of Excel tables are used. Although Excel is very powerful in creating and processing data, it is not easy for us to completely master it, so as ordinary users only need to Just master the basics of using Excel. Now I will give you a basic tutorial on Excel. 1. Set the column width and row height. Select the entire row or column of cells, right-click the mouse and select &quot;Column Width&quot; or &quot;Row Height&quot;, fill in the set value, and that's it. 2. Automatically sum the data and select the cell where the data is located. and a blank cell, and then click the summation symbol to automatically sum. 3. Pivot Table Select the entire table and click Insert-Pivot Table to insert the Pivot Table.

Go Language Basics Tutorial: Quick Start Guide Go Language Basics Tutorial: Quick Start Guide Mar 21, 2024 pm 06:09 PM

Title: Go Language Basics Tutorial: Quick Start Guide In today's software development field, Go language has gradually received widespread attention and application due to its simplicity, efficiency, and strong concurrency. This article will lead you to quickly get started with the Go language and help readers better understand and master the basic knowledge of the Go language through specific code examples. 1. Install the Go language environment. First, we need to install the Go language development environment on the computer. You can download and install the appropriate version from the Go official website (https://golang.org/)

Use PHP and AngularJS to develop an online file management platform to facilitate file management Use PHP and AngularJS to develop an online file management platform to facilitate file management Jun 27, 2023 pm 01:34 PM

With the popularity of the Internet, more and more people are using the network to transfer and share files. However, due to various reasons, using traditional methods such as FTP for file management cannot meet the needs of modern users. Therefore, establishing an easy-to-use, efficient, and secure online file management platform has become a trend. The online file management platform introduced in this article is based on PHP and AngularJS. It can easily perform file upload, download, edit, delete and other operations, and provides a series of powerful functions, such as file sharing, search,

How to write basic custom instructions using PHP How to write basic custom instructions using PHP Jun 23, 2023 pm 12:55 PM

As more and more people begin to learn and use the PHP language, writing custom instructions for PHP has become a very hot topic. Writing custom instructions allows programmers to complete repetitive tasks more efficiently, while also making the program more flexible. This article will introduce basic PHP custom instruction writing and show relevant code examples to help readers better understand. Writing custom instructions in PHP is achieved by defining functions or classes. For writing custom instructions for functions, you need to use PHP’s built-in function creat

See all articles