search
HomeWeb Front-endJS TutorialAngularJS environment building tutorial

AngularJS environment building tutorial

Jan 02, 2018 am 09:50 AM
angularjsjavascriptTutorial

This article mainly introduces the process of setting up the AngularJS environment for beginners. The features of Angular-cli are mentioned in the article. Let's take a look at it. I hope it can help beginners successfully build an AngularJS environment.

What is AngularJS?

AngularJS is an open source web application framework. It was originally developed in 2009 by MISKO Hevery and Adam Abrons. Now maintained by Google

AngularJS Features

AngularJS is a powerful JavaScript-based development framework for creating Rich Internet Applications (RIA).

AngulajJS provides developers the option (using JavaScript) to write client-side applications in a clean MVC (Model-View-Controller) way.

Applications written in AngularJS are cross-browser compatible. AngularJS uses JavaScript code to automatically handle adaptation to each browser.

AngularJS is open source, completely free, and developed and maintained by thousands of developers around the world. It is released under the Apache License version 2.0.

Overall, AngularJS is a framework for building large-scale, high-performance web applications while making them easy to maintain.

1. Here is a brief introduction to the features of Angular-cli:

Angular-cli can quickly build a framework and create modules, services, classes, directives, etc.;

Yes The function of webpack can realize code separation, on-demand loading, etc.;

automatically configures the development environment, test environment, and production environment, can realize code packaging and compression and hot deployment, and can also realize module testing and end-to-end Test

Angular-cli can automatically identify the pre-compilation of sass and less through the suffix;

Angular-cli can configure TypeScript when creating, and can also make some personalized configurations;

The project structure created through Angular-cli is the best practice and can be used in the production environment;

2. Install nodejs

AngularJS needs to use Nodejs, so we need to first To install nodejs, you need to use nodejs. The download address of nodejs is: https://nodejs.org/en/download/,

3. Install npm and cnpm

The next step is to install npm ,

NPM is a package management tool installed along with NodeJS. It can solve many problems in NodeJS code deployment. Common usage scenarios include the following:

Allow users to download others from the NPM server Write third-party packages for local use.

Allows users to download and install command line programs written by others from the NPM server for local use.

Allows users to upload packages or command line programs written by themselves to the NPM server for others to use.

The installation of nodejs and npm has been completed here, but there will be some problems if you use npm to install it in Datianchao, so we use cnpm to install it, which is also a package of npm.

Install cnpm, execute the command

npm i -g cnpm

After executing this command, wait for completion, then enter cnpm version to check whether the installation is completed. I have already installed it here , so you can go in.

After installing cnpm, we start to install Angular-cli.

Execute the command

cnpm i -g angular-cli

Then you can execute the ng version command to check whether the installation is complete and the version of angular-cli

After the installation is complete, we can use the ng command and start creating the project.

4. Project creation

After installing angular-cli, you can directly create the project and execute the command

ng new JustForTest

where JustForTest is the project Name

Executing this command creates a lot of files, and you need to wait for a while. This step will take a long time, and you need to wait until the installation of nod_.modules is completed

Start directly using ng serve.

In this way, you can start the project directly. We enter in the browser: http://localhost:4200 and you can directly access:

5. Import the project

If it is How do we start a project locally if we find it online? Let’s do it in detail:

I recommend everyone to take a look at this tutorial by Teacher Da Mo: The Angular2.0 video tutorial is here

. For the demonstration here, we also use a project of Teacher Da Mo: NiceFish , first we need to clone the project through git, which will not be demonstrated here. This is the project address of NiceFish: http://git.oschina.net/mumu-osc/NiceFish

After the project is cloned , the command line enters the directory where the project is located.

Execute command

cnpm i -g @angular/cli

Let me explain here, before we installed the global angular-cli.

Wait for the command execution to complete, then execute the command

cnpm install

Then execute the command

ng serve -prod -aot

Then wait for the compilation to complete.

After completion, we can enter in the browser:

http://localhost:4200 to access the project.

Related recommendations:

Detailed tutorial on how to build a vue, node, and webpack environment with graphic examples

A simple tutorial on how to build a vue environment with detailed examples

The clearest graphic tutorial on building a PHP server environment

The above is the detailed content of AngularJS environment building tutorial. For more information, please follow other related articles on the PHP Chinese website!

Statement
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
The Future of Python and JavaScript: Trends and PredictionsThe Future of Python and JavaScript: Trends and PredictionsApr 27, 2025 am 12:21 AM

The future trends of Python and JavaScript include: 1. Python will consolidate its position in the fields of scientific computing and AI, 2. JavaScript will promote the development of web technology, 3. Cross-platform development will become a hot topic, and 4. Performance optimization will be the focus. Both will continue to expand application scenarios in their respective fields and make more breakthroughs in performance.

Python vs. JavaScript: Development Environments and ToolsPython vs. JavaScript: Development Environments and ToolsApr 26, 2025 am 12:09 AM

Both Python and JavaScript's choices in development environments are important. 1) Python's development environment includes PyCharm, JupyterNotebook and Anaconda, which are suitable for data science and rapid prototyping. 2) The development environment of JavaScript includes Node.js, VSCode and Webpack, which are suitable for front-end and back-end development. Choosing the right tools according to project needs can improve development efficiency and project success rate.

Is JavaScript Written in C? Examining the EvidenceIs JavaScript Written in C? Examining the EvidenceApr 25, 2025 am 12:15 AM

Yes, the engine core of JavaScript is written in C. 1) The C language provides efficient performance and underlying control, which is suitable for the development of JavaScript engine. 2) Taking the V8 engine as an example, its core is written in C, combining the efficiency and object-oriented characteristics of C. 3) The working principle of the JavaScript engine includes parsing, compiling and execution, and the C language plays a key role in these processes.

JavaScript's Role: Making the Web Interactive and DynamicJavaScript's Role: Making the Web Interactive and DynamicApr 24, 2025 am 12:12 AM

JavaScript is at the heart of modern websites because it enhances the interactivity and dynamicity of web pages. 1) It allows to change content without refreshing the page, 2) manipulate web pages through DOMAPI, 3) support complex interactive effects such as animation and drag-and-drop, 4) optimize performance and best practices to improve user experience.

C   and JavaScript: The Connection ExplainedC and JavaScript: The Connection ExplainedApr 23, 2025 am 12:07 AM

C and JavaScript achieve interoperability through WebAssembly. 1) C code is compiled into WebAssembly module and introduced into JavaScript environment to enhance computing power. 2) In game development, C handles physics engines and graphics rendering, and JavaScript is responsible for game logic and user interface.

From Websites to Apps: The Diverse Applications of JavaScriptFrom Websites to Apps: The Diverse Applications of JavaScriptApr 22, 2025 am 12:02 AM

JavaScript is widely used in websites, mobile applications, desktop applications and server-side programming. 1) In website development, JavaScript operates DOM together with HTML and CSS to achieve dynamic effects and supports frameworks such as jQuery and React. 2) Through ReactNative and Ionic, JavaScript is used to develop cross-platform mobile applications. 3) The Electron framework enables JavaScript to build desktop applications. 4) Node.js allows JavaScript to run on the server side and supports high concurrent requests.

Python vs. JavaScript: Use Cases and Applications ComparedPython vs. JavaScript: Use Cases and Applications ComparedApr 21, 2025 am 12:01 AM

Python is more suitable for data science and automation, while JavaScript is more suitable for front-end and full-stack development. 1. Python performs well in data science and machine learning, using libraries such as NumPy and Pandas for data processing and modeling. 2. Python is concise and efficient in automation and scripting. 3. JavaScript is indispensable in front-end development and is used to build dynamic web pages and single-page applications. 4. JavaScript plays a role in back-end development through Node.js and supports full-stack development.

The Role of C/C   in JavaScript Interpreters and CompilersThe Role of C/C in JavaScript Interpreters and CompilersApr 20, 2025 am 12:01 AM

C and C play a vital role in the JavaScript engine, mainly used to implement interpreters and JIT compilers. 1) C is used to parse JavaScript source code and generate an abstract syntax tree. 2) C is responsible for generating and executing bytecode. 3) C implements the JIT compiler, optimizes and compiles hot-spot code at runtime, and significantly improves the execution efficiency of JavaScript.

See all articles

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!