AngularJs Beginner's Introductory learning notes

Source: Internet
Author: User

Just learn angular, do some notes to make it easy for you to look over.

Ng-app: Fill in the name of the module

Ng-init: Initializing data (typically initialized via controller)

Ng-model: Fill out the data model

Ng-bind: Binding data Model for presenting data

Ng-controller: Controller for storing data, changing data, etc.

Ng-disabled: Binding Application Data to HTML disabled properties

Ng-show (ng-hide): Controls the display or hiding of DOM elements by true or false data

ng-event name: Corresponding event for binding HTML (ex: Ng-click binding onclick Event) Note: onchange time cannot be bound

Ng-include: Used to contain HTML content that needs to be in a server environment

Ng-repeat: Used to traverse the data and fill in the HTML

{{$scope. Name}}: Two curly braces are angular expressions that can contain literals, operators, and variables

$http. Get (URL) functions for reading server data

Cases:

function Customerscontroller ($scope, $http) {
$http. Get (".. /xxx.php ")
. Success (Function (response) {$scope. data = response;});
}
Create a module
var app = Angular.module ("myApp", []); MyApp is the module name
New Controller
App.controller ("Mycontroller", function ($scope) {
$scope. Data = "something";
$scope. method = function () {
/* Some actions */
}
})
Filter filters

With the pipe symbol "|" Can be followed, for example

<p><input type= "text" ng-model= "name" ></p>
<ul>
<li ng-repeat= "x in Names | filter:name |: ' Country ' >
{{(X.name | uppercase) + ', ' + X.country}}
</li>
</ul>

Currency: Formatting numbers for currency formats
Filter: Select a subset from the array item
Lowercase: formatted string is lowercase
ORDER BY: Arrange an array from an expression
Uppercase: formatted string is uppercase

AngularJs Beginner's Introductory learning notes

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.