Angular Simple to use

Source: Internet
Author: User

Simple example, directly on the code

1. Hello World


<! DOCTYPE html>
var HelloWorld = angular.module ("HelloWorld", [])//helloworld.controller ("Helloworldctrl", function ($scope) {can not ' $ Scope ' parameter Helloworld.controller ("Helloworldctrl", [' $scope ', function ($scope) {$scope. HelloWorld = "Hello World";}]);


Run:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/A4/wKioL1Xqh_SgHONvAADP_zGHm1s434.jpg "title=" 1.png " alt= "Wkiol1xqh_sghonvaadp_zghm1s434.jpg"/>

Here is the end of a complete HelloWorld example.

In fact there is a problem here, when we refresh faster, or the loading of the ANGULARJS removed will be displayed

{{HelloWorld}}

This is very unfriendly to the page display, so how to solve it? We need instructions here, and we explain the instructions in detail.


2, the general project directory structure

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/AA/wKiom1XqtjODURHqAACnLRwCxAo495.jpg "title=" 2.png " alt= "Wkiom1xqtjodurhqaacnlrwcxao495.jpg"/>

Under the project, the general situation is: CSS, IMG, SRC, JS, TPL, and Portal files index.html

If we need to install Nodejs-based tools, such as code obfuscation tools, automated tests, and so on, it's usually installed under the Node_modules directory, and if you need to test, you'll also have the test folder.

Installing these assistive tools through the NMP

1, Karma: Unit Test Tool. Use Karma-coverage coverage with Jasmine

2. Jasmine: Provides a set of syntax for writing test cases

3, Grunt:js file merge, JS code compression www.grunt.org to the official Web view gruntfilt example, install the necessary plug-ins

Grunt-contrib-ugify Code Obfuscation

Grunt-contrib-concat file Merge

Grunt-contrib-watch Monitoring file changes

4, Bower: Rely on management tools. Automatic installation of dependent components, dependent component monitoring, version control Http://bower.io

5, Batarang:angularjs Debugging Tools (Chrom)

6. Http-server: Simple HTTP Service

7. Protractor: A test tool specially tailored for angularjs. Based on Webdriverjs

Principle: Using Webdriverjs to invoke the interface of the browser directly with Nodejs


This article is from the "Chase Dream" blog, please be sure to keep this source http://dreameng.blog.51cto.com/1187899/1691598

Angular Simple to use

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.