Angularjs Summary (v) instruction application and assignment operation of common control

Source: Internet
Author: User

1. Common directives

1 <DivNg-controller= "Jsyd-controller">2     <Divstyle= "float:left;width:100%; "Ng-show= "clickvalue1== ' Registration '">3 4         <Divng-include src= "'/partials/11.html '"></Div>5 6     </Div>7     <Divclass= "Item"Ng-class= "{true: ' item ', false: ' item2 '}[clickvalue== ' accept ']">8 9         <ul>Ten  One             <Divng-disabled= "Isdisable"Ng-click= "clickvalue= ' Accept '">Reception information</Div> A  -         </ul> -  the     </Div> - </Div>

Ng-class, Ng-show, ng-disabled, Ng-if, Ng-hide
Assigning values when loading pages (focus: Ng-class's CSS assignment operation)
$scope. Clickvalue = ' admissibility ';
$scope. clickvalue1= ' Registration ';
$scope. Isdisable=true;

2. Row selection

1 <Table>2     <theadstyle= "Background-color: #e4e9ef;">3         <TR>4             <TDclass= "TD"style= "width:10%">Serial number</TD>5             <TDclass= "TD"style= "width:20%">Parcel Code</TD>6             <TDclass= "TD"style= "width:10%">Parcel Area</TD>7             <TDclass= "TD"style= "width:30%">Operation</TD>8         </TR>9     </thead>Ten     <tbody> One         <TRNg-class= ' {selected:ZJDFG==selectedrow} 'Ng-click= "Tdxxclick (ZJDFG)"ng-repeat= "ZJDFG in Zjdfglist"> A             <TDclass= "TD"Ng-bind= "$index +1">1</TD> -             <TDclass= "TD">{{ZJDFG. ZDDM}}</TD> -             <TDclass= "TD">{{ZJDFG. ZDMJ}}</TD> the             <TDclass= "TD"> -                 <aname={{postitem. Id}}type= "button"Ng-click= "CHECKZJDFG (ZJDFG)">View</a> -                 <aname={{postitem. Id}}type= "button"Ng-show= "Isck"ng- - Show= "Isshowback"ng-disabled= "Isdisable"Ng-click= "EDITZJDFG (ZJDFG)">Edit</a> +                 <aname={{postitem. Id}}type= "button"Ng-show= "Isck"ng- - Show= "Isshowback"Ng-click= "DELETEZJDFG (zjdfg.id)">Delete</a> +             </TD> A         </TR> at     </tbody> - </Table>

The application of Ng-click, Ng-repeat and Ng-class

Row selection
$scope. Tdxxclick = function (data) {
$scope. selectedrow = data;
}

3. Drop-down frame ng-options, Ng-model application

<ng-model= "Qllxcode"  ng-options= "option. Code as option. Name for option in Qllx "></Select>

Js:

var add = {"Name": "--Please select--", "Code": "1"= [{code:1,name: ' Nihao '},{code:2,name: ' Nihao '}]; if NULL )    = $scope. Qllx[0]. Code;

4.radio button

1 <  value= "{{item.id}}"  name= "Ztfaxz"  type= "Radio" Ng-model = "meischecked" Ng-click = "Meclick (item.id)" />

Js:

// $scope is selected when value and meischecked are equal . meischecked = $scope. Custom.meid;

5.checkbox

1 <DivNg-model= "Permissiongroups"class= "Post_roles">2     <labelng-repeat= "Roleitem in Permissiongroups"class= "Role_name"style= "width:175px;">3         <inputtype= "checkbox"Ng-model= "roleitem.ischecked" />&nbsp;<label>{{Roleitem.name}}</label>4     </label>5 </Div>

Js:

// true to select $scope. postiteminfo.permissiongroups = [];angular.foreach ($scope. permissiongroups,function  (value, key) {    if  (value.ischecked) {        $scope. PostItemInfo.PermissionGroups.push (value.id);    }});

Angularjs Summary (v) instruction application and assignment operation of common control

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.