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!