常見需要在submit後reset表單的狀態與所有欄位重置預設值參考:
取得表單變數
$scope.initContactForm = function(contactName){
logger.debug('initContactForm');
$scope.contactForm = contactName;
};
重設
$scope.restart = function(){
logger.debug('restart');
$scope.contactForm.$setPristine();
$scope.isShowThanks = false;
//reset
$scope.contact = {
type: '0',
name: null,
mobilePhone: null,
meetdate: null,
meettime: '9:00',
company: '明久家具嘉義店',
jobTitle: null,
email: null,
title: null,
content: null //base64 encode
};
};
沒有留言:
張貼留言
留個話吧:)