2014-09-28 73 views
0

我似乎找到了一个解决方案,因为它不是输出形式的数据角形式屏幕

var app = angular.module('myApp', []); 

app.controller('mainController', ['$scope', function($scope) { 

    $scope.update = function(person){ 
     $scope.club = angular.copy($scope.person); 
    }; 

}]); 

小提琴: http://jsfiddle.net/2ykgjmfs/

+0

如果我们可以看到表单逻辑 – Pytth 2014-09-28 16:56:31

回答

0
var app = angular.module('myApp', []); 

app.controller('mainController', ['$scope', function($scope) { 

    $scope.person = {}; 
    $scope.club = []; 

    $scope.update = function(person){ 
     $scope.club.push(person); 
     $scope.person = {}; // clear out the form 
    }; 
}]); 

或只是......

ng-click="update()" 

and

$scope.update = function() { 
    // you don't need to pass the person because it's on the $scope 
    $scope.club.push($scope.person); 
    $scope.person = {}; // clear out the form 
};