(1) Hello World, angularjshello

Source: Internet
Author: User

(1) Hello World, angularjshello

Previous projects used JQuery and original javascript. Recently, a project used AngularJS, RequireJS, and other popular frameworks. Here I write some blogs to record my learning process. Although the original name is used, it is actually based on some online materials, and some of my own practices and understandings. Before getting familiar with AngularJS, it is estimated that there are no high-quality articles, which can only be used as study notes and memos. The exercise version is the latest stable version 1.2.25.


The sample code is as follows:

<!doctype html>Open the webpage in a browser and enter it in the text box. The page is automatically displayed in real time. If javascript or jquery is used to complete such a small function, we need to register the listening event, obtain the value of the text control, and then add the value to 

1. ng-app: It can be placed on any dom node, representing that the node and all its subnodes are within the management scope of AngularJS. If this flag is removed, it is found that the AngularJS framework does not work.

<!doctype html>This time, we put ng-app on <div>. We can see that 


2. ng-model: This is the bidirectional binding feature of AngularJS data. Easy to understand: Tell AngularJS that this is a data model. You can save it to the memory for me. The data is modified on the interface, and the data in the memory is automatically modified. The variable value in the memory is also changed on the Interface display. This feature is obviously very convenient and can maintain data consistency, so that we do not need to add code to complete this function.


3. {yourName}: This is the expression syntax provided by the Framework. It can display the value of the data model in the memory. This is similar to <s: property> and <s: text> of struts2. It is used to display data. This is just the syntax format defined by AngularJS. It is similar to the EL expression on the JSP page and the OGNL of struts2. It is a data acquisition mechanism.





C # as follows: Hello World. How can I call the following code to copy the code in a cs file during window creation?

This is a console application, not a windows application!
Region ~~

Using System;
// A "Hello World! "Program in C #
Namespace HelloWorld
{
Class Hello
{
Public static string SayHello ()
{
Return "Hello World! ";
}
}
}

Then write in your form
This. label1.Text = HelloWorld. Hello. SayHello ();

Establish an AngularJS Environment

Pay attention to the following key areas,
1. Add ng-app
2. Introduce angularjs.
See angularjs.org/here for details.
<! Doctype html>

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.