Angularjs Curd Detailed and instance code _ANGULARJS

Source: Internet
Author: User

Angularjs Curd

Objective

Based on a mobile phone end of the project used Angularjs, bite the bullet to use, there are a lot of questions still need one by one to verify that the beginning always feel that can not find the north, always feel that there are many concepts, and it seems that NG is a mixture of MVC and MVVM thought, a simple curd demo. Of course, along this demo can also extend a lot of knowledge points, such as: With paging query, connect the background database, call Webapi, layered use Servcice, Factory.

Effect chart

<script type= "Text/javascript" > var app=angular.module (' myApp ', []);

       

      App.controller (' Empctrl ', function ($scope) {$scope. emparr=[]; Add $scope. Btnclk=function () {$scope. Emparr.push ({' arr_id ': $scope. ID, ' arr_name ': $scope. Name, ' ARR_DESG ': $s

        COPE.DESG});

        $scope. id= ';

        $scope. Name= ';

      $scope. desg= ';

      } var key= ';

        Edit $scope. Edit=function (emp,indx) {key=indx;

        Console.log (INDX);

        Console.log (EMP);

        $scope. id=emp.arr_id;

        $scope. Name=emp.arr_name;

      $scope. DESG=EMP.ARR_DESG;

        }//Modify $scope. Btnupd=function (ID,NAME,DESG) {$scope. Emparr[key].arr_id=id;

        $scope. Emparr[key].arr_name=name;

         

        $scope. EMPARR[KEY].ARR_DESG=DESG;

        $scope. id= ';

        $scope. Name= ';

      $scope. desg= ';

      $scope. Del=function (ID) {$scope. Emparr.splice (id,1);}

    }); 


  


 </script>

Above is the ANGULARJS curd data collation, follow-up continue to supplement the relevant information, thank you for your support of this site!

Related Article

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.