数据不使用angularjs保存在前端

时间:2017-12-29 06:34:55

标签: html angularjs

使用angularjs不会在前端保存数据。这是angularjs代码,它包含三个函数,即:enableEditor,saveData和getTemplate:

$scope.editorEnabled = false;
$scope.selected = {};
//Edit code
$scope.enableEditor = function(row){
    $scope.editorEnabled =true;
    $scope.selected= angular.copy(row);
};

//Save code
$scope.saveData = function(row){
    $scope.selected = {};
    $scope.disableEditor();
    var xArr = [];
    $.each(row, function(key,value) {
        if(key == "actual_result"){
            var actual_arr=[];
            $.each(value, function(key1,value1){
                actual_arr.push(key1+":"+value1 );
            });
        } 
        else { 
            xArr.push(key+":"+value);
        }
    });
}; 

//getTemplete for editing
$scope.getTemplate = function(row){
    if (row.tc_id === $scope.selected.tc_id){//variable for ng-hide or ng-show};
        $scope.editorEnabled = true;
    } else {
        $scope.editorEnabled = false;
    }
};

0 个答案:

没有答案