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