[Pro angular.js] Learning Note 1.1: Setting up the development environment

Source: Internet
Author: User
Tags install node node server

can use Yeoman.io, very convenient. I have written an essay about how to use it. There is also an article about this: http://www.cnblogs.com/JoannaQ/p/3756281.html

Code Editor, under the Mac used a bit of webstorm, too disgusting. In addition to finding the author of the book using the development environment is Windows + vs Express 2013, I also use VS Express to Update2 for ease of learning. VS2013 used to be comfortable, the webstorm than the camel poop. Maybe it's because I'm not used to it.

1, install node. js, nothing to say, to the official website to download, install.

2. Then install Web Server. The author uses node. JS's connect to write a Web server. The following is the installation of the Connect module. Run cmd with the administrator and go to the installation path for node. JS, which is the path to the node's executable file, running:

NPM Install Connect

This NPM is node's package installer, which is also used to download the required files for the module under the path of node's executable file.

After installing the Connect module, create a new server.js file under the path of node's executable file, this is our web server, the code is as follows:

var connect = require (' Connect '); Connect.createserver (Connect.static (". /angularjs ")). Listen (5000);

The file, created a basic Web server, he requested on the 5000 port number, for the Angularjs file in this folder service. This folder is a level with the installation folder of node. js.

3. Installation test System

One of the most important aspects of ANGULARJS is the provision of unit testing. The book authors use the Karma Test Runner and the Jasmine Test framework, both of which are widely used and easy to use. installation command:

NPM install-g Karma

This test system will be used in chapter 25.

4. Create a project path

My node. JS installation path is C:\angularjs\nodejs. My project path is C:\ANGULARJS\ANGULARJS. If you use a different path, adjust the service path in the server.js above.

4.1. Download Angularjs Library

Nothing to say, choose a stable version without compression, I put it in the root directory of the project. C:\angularjs\angularjs\angular.js.

4.2 Download Angularjs Extension

In the future chapters will be used, here is downloaded. This includes the Touch,animate,mocks,route,sanitize,locale, which is also placed under the project root directory.

4.3 Downloads Bootstrap

There's nothing to say, Bootstrap.css and bootstrap-theme.css are copied to the project and directory. This book does not use the JavaScript features of Bootstrap.

4.4 Optional, can be installed Livereload

In the Yeoman.io, with the use of the next, very useful. In short, this is the code Editor in the end of the modification, there is no need to refresh the browser, you can see the updated effect.

4.5 Downloads Deployd

This is only used in the sixth chapter, and now it is not installed.

5. Perform a simple test

Under the project folder, create a new test.html with the following code:

<!DOCTYPE HTML><HTMLNg-app><Head><title>First Test</title><Scriptsrc= "Angular.js"></Script><Linkhref= "Bootstrap.css"rel= "stylesheet" /><Linkhref= "Bootstrap-theme.css"rel= "stylesheet" /></Head><Body><Divclass= "Btn Btn-default">{{' AngularJS '}}</Div><Divclass= "Btn btn-success">Bootstrap</Div></Body></HTML>

6. Start Web Server

Under the node. JS installation path, execute the following command:

Node Server.js

He will create a listener for the HTTP request, on the 5000 port number. You can view the test page by entering http://localhost:5000/test.html in the browser. It has the bootstrap effect.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.