angular.module('app',[]) .controller('validateboxCtr', function($scope, $element) { $scope.name = ''; $scope.email = ''; $scope.birthday = ''; $scope.url = ''; $scope.phone = ''; $scope.data = { 'Name':$scope.name, 'Email':$scope.email, 'Birthday':$scope.birthday, 'URL':$scope.url, 'Phone':$scope.phone }; $scope.$watch('data',function(value){ console.log(value); }); // console.log($scope) });代碼如上,ng-model 綁定了5個(gè)值,想全部放入data變量中,但是data變量卻無(wú)法雙向綁定了,求解決
angular 將ng-model的值保存到scope變量里,怎么監(jiān)聽(tīng)變量的變化呢
滄海一幻覺(jué)
2018-09-08 14:12:06