search
HomeWeb Front-endJS TutorialDetailed explanation of the steps to build AngularJS environment

Detailed explanation of the steps to build AngularJS environment

Apr 16, 2018 pm 02:06 PM
angularjsjavascriptDetailed explanation

This time I will bring you a detailed explanation of the steps to build the AngularJS environment. What are the precautions for building the AngularJS environment? The following is a practical case, let’s take a look.

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

AngularJSFeatures

AngularJS is a powerful JavaScript-based development framework for creating rich Internet applications (RIA). AngulajJS provides developers with 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 is 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.;

It has the function of webpack, which can realize code separation, on-demand loading, etc.;

Automatically

configure the development environment

, test environment, and production environment, which can realize code packaging, compression and hot deployment, as well as module testing and end-to-end testing Angular-cli can automatically identify the precompilation 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 a best practice and can be used in production environments;

2. Install nodejs AngularJS requires Nodejs, so we need to install nodejs first and 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 third-party packages written by others from the NPM server 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 they write to the NPM server for others to use.

The installation of nodejs and npm has been completed here. However, 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 and execute command

npm i -g cnpm

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

After installing cnpm, we start installing Angular-cli.

Excuting an order

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 create the project directly 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: http://localhost:4200 in the browser to directly access:

5. Importing the project

If we are looking for a project online, how do we start it locally? Let’s do it in detail:

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

, here we also use a project of Teacher Da Mo: NiceFish. First we need to clone the project through git. We will not demonstrate this 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.

Excuting an order

cnpm i -g @angular/cli

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

Wait for the command execution to complete before executing the command

cnpm install

Then execute the command

ng serve -prod -aot

Then wait for the compilation to complete.

Once completed, we can enter in the browser:

http://localhost:4200 Access the project.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:



The above is the detailed content of Detailed explanation of the steps to build AngularJS environment. 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
Python vs. JavaScript: Performance and Efficiency ConsiderationsPython vs. JavaScript: Performance and Efficiency ConsiderationsApr 30, 2025 am 12:08 AM

The differences in performance and efficiency between Python and JavaScript are mainly reflected in: 1) As an interpreted language, Python runs slowly but has high development efficiency and is suitable for rapid prototype development; 2) JavaScript is limited to single thread in the browser, but multi-threading and asynchronous I/O can be used to improve performance in Node.js, and both have advantages in actual projects.

The Origins of JavaScript: Exploring Its Implementation LanguageThe Origins of JavaScript: Exploring Its Implementation LanguageApr 29, 2025 am 12:51 AM

JavaScript originated in 1995 and was created by Brandon Ike, and realized the language into C. 1.C language provides high performance and system-level programming capabilities for JavaScript. 2. JavaScript's memory management and performance optimization rely on C language. 3. The cross-platform feature of C language helps JavaScript run efficiently on different operating systems.

Behind the Scenes: What Language Powers JavaScript?Behind the Scenes: What Language Powers JavaScript?Apr 28, 2025 am 12:01 AM

JavaScript runs in browsers and Node.js environments and relies on the JavaScript engine to parse and execute code. 1) Generate abstract syntax tree (AST) in the parsing stage; 2) convert AST into bytecode or machine code in the compilation stage; 3) execute the compiled code in the execution stage.

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.

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

EditPlus Chinese cracked version

EditPlus Chinese cracked version

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

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.