The realization of the ANGULAR-PHONECAT project of angular learning

Source: Internet
Author: User

---restore content starts---

Angularjs's official website provides a sample project for learning: Phonecat. This is a web app where users can browse some Android phones, learn more about them, and perform search and sort operations.

Get Source code

The source code for the Phonecat project is hosted on GitHub, so you need to install git before you get the source, and after you install Git, you can download it from git clone:

git clone--depth= https://github.com/angular/angular-phonecat.git

The –DEPTH=14 option means that only the last 14 code submissions are downloaded, which reduces the size of the downloaded file and speeds up the download.

Install dependent packages

Phonecat is a Web application, so it's best to run it in a Web server for best results. Official recommended installation of node. js

The run and test of the Phonecat project relies on a number of other tools that can be installed with the NPM command after installing node. js. The following commands need to be run under the Angular-phonecat project path:

Install

After you run the command, the following dependency packages are installed under the ANGULAR-PHONECAT project path:

    • Bower . Package Manager
    • http-server . Lightweight Web server
    • Karma . For running Unit tests
    • protractor . For running end-to-end testing
Run the Phonecat project

After doing this, running the PHONECAT project is simple, run the following command under the ANGULAR-PHONECAT project path:

NPM start

Once Phonecat is running, you can open http://localhost:8000/app/index.html in your browser to access the Web App.

Run unit tests

Unit tests in the PHONECAT project are done using Karma, and all unit test cases are stored in the Test/unit directory. You can run unit tests by executing the following command:

NPM Test

Note: You must have Google Chrome installed on your computer before you run unit tests.

run end-to-end testing

The PHONECAT project uses end-to-end testing to ensure the operability of Web applications, and this end-to-end testing is done by using protractor, where all end-to-end test cases are stored in the TEST/E2E directory. You can run an end-to-end test by performing the following steps:

// update webdriver, this command only runs once NPM run update-webdriver// run Phonecatnpm start

Open another command-line window in which to run:

NPM Run Protractor

The realization of the ANGULAR-PHONECAT project of angular learning

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.