ANGULARJS Study Notes

Source: Internet
Author: User

Reference: Http://campus.codeschool.com/courses/shaping-up-with-angular-js/contents

Reference: http://www.ituring.com.cn/article/13474


1) Load Angularjs script

<script src= "Http://cdn.bootcss.com/angular.js/1.4.5/angular.min.js" ></script>



2) Ng-app, tell Angularjs to process the entire HTML page and guide the app


3) Using variables

Hello {{' World '}}!



4) Ng-model for two-way binding

<input type= "text" ng-model= "yourname" placeholder= "World" >


5) Whether the ng-show is displayed

Ng-show={{product.images.length}}


6) Traverse Ng-repeat

<div class= "Product row" ng-repeat= "product in Store.products" >

Index $index

<TR ng-repeat= "Item in Items" > <td>{{$index + 1}}</td> <td>{{item.name}}</td> <td>{{item.price | currency}}</td></tr>


7) Using Filters

Format (time, case uppercase, currency currency, limit limitto:3)

Sort (|orderby: "-price")


8) Reference Picture NG-SRC


9) A model can have multiple controllers

var app=angular.module ("Store", []); App.controller ("Storecontroller", function () {this.products = [];}); App.controller ("Tabcontroller", function () {this.tab = 1;});


Ng-class, add a class

<li ng-class= "{active:tab.isSet (1)}" >


11) Select tab page

Ng-click= "Tab.settab (1)" ng-show= "Tab.isset (1)"


ANGULARJS Study 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.