星期一, 2月 13, 2023

Angular 1.5 取得表單變數與重設

 常見需要在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
};
};

沒有留言:

張貼留言

留個話吧:)

其他你感興趣的文章

Related Posts with Thumbnails