Angularjs A Little learning note

Source: Internet
Author: User

ng-options= "Item.action for item in Todos"

Basic forms of ng-options expressions, such as "< tags > for < items > in < arrays >

<option value= "" > (Chosse one) </option>

Ng-options= "Item.id as item.action for item in Todos"

Forms in the form of < selected properties >as < tags > for < variables > in < arrays >

ng-options= "Item.action group by Item.place for item in Todos"

Group objects

Using a non-scoped controller

  

1 <!DOCTYPE HTML>2 <HTMLLang= "en"Ng-app= "IAPP">3 <Head>4     <MetaCharSet= "UTF-8">5     <title>Document</title>6     <Linkrel= "stylesheet"href= "Bower_components/bootstrap/dist/css/bootstrap.css">7     <Linkrel= "stylesheet"href= "Bower_components/bootstrap/dist/css/bootstrap-theme.css">8     <Scriptsrc= "Bower_components/angular/angular.js"></Script>9     <Script>Ten Angular.module ('iApp',[]) One . Controller ('Topctrl',function(){ A                  This. DataValue='Hello,adam'; -                  This. Reversetext=function(){ -                      This. DataValue= This. Datavalue.split (""). Reverse (). Join (""); the                 } -             }) -     </Script> - </Head> + <Body> -     <Divclass= "Well"Ng-controller= "Topctrl as CTRL"> +         <h4>Top level Controller</h4> A         <Divclass= "Input-group"> at             <spanclass= "Input-group-btn"> -                 <Buttonclass= "Btn Btn-default"Ng-click= "Ctrl.reversetext ()">Reverse</Button> -             </span> -             <inputtype= "text"class= "Form-control"Ng-model= "Ctrl.datavalue"> -         </Div> -     </Div>     in </Body> - </HTML>

When you apply a non-domain controller, the expression is formatted taxiing such as:< to apply the controller > as < variable name >

Then use the CTRL variable in the view to access the data and behavior, similar to this: <input.....ng-model= "ctrl.datavalue" >

Angularjs A Little learning note

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.