1
我在HTML中編寫了一個表單,並在那裏使用了角度js。通過電子郵件發送一個角度Js格式
沒有什麼奇特的,一個簡單的形式與mail to:email address
在行動。
鏈接http://www.chami.com/tips/internet/010597I.html說它應該單獨使用mailTo添加到操作屬性。
但它不起作用。我還需要添加什麼?
<!DOCTYPE HTML>
<html lang="en-US" ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>Form</title>
<meta name="viewport">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<link rel="stylesheet" href="css/styling.css" />
</head>
<body ng-app="myApp">
<form name="userForm" action="mailto:[email protected]" ng-controller="sample" method="POST" enctype="multipart/form-data" novalidate>
<div class="row col-lg-offset-3">
<div class="form-group col-lg-6" ng-class="{ 'has-error': userForm.name.$invalid && userForm.name.$dirty}">
<label class="control-label">Name</label>
<input type="text" class="form-control" name="name" ng-model="user.name" ng-required="true" ng-minlength="3" placeholder="Name" />
<span class="error-message" ng-show="userForm.name.$dirty
&& userForm.name.$error.required">You are required to provide your name</span>
<span class="error-message" ng-show="userForm.name.$dirty
&& userForm.name.$error.minlength">Your name should contain 3 or more characters</span>
</div>
</div>
<div class="row col-lg-offset-3">
<div class="form-group col-lg-6" ng-class="{ 'has-error': userForm.email.$invalid && userForm.email.$dirty }">
<label class="control-label">Email</label>
<input type="email" class="form-control" name="email" ng-model="user.email" ng-required="true" placeholder="Email" />
<span class="error-message" ng-show="userForm.email.$dirty
&& userForm.name.$error.required">You are required to provide your Email Id</span>
</div>
</div>
<div class="row col-lg-offset-3">
<div class="form-group col-lg-6" ng-class="{ 'has-error': userForm.phonenumber.$invalid && userForm.phonenumber.$dirty}">
<label class="control-label">Mobile Number</label>
<input type="text" class="form-control" name="phonenumber" ng-model="user.phonenumber" ng-minlength="10" ng-maxlength="10" ng-required='true' placeholder="10 digit Mobile Number" />
</div>
</div>
<div class="row col-lg-offset-3">
<div class="form-group col-lg-6" ng-class="{ 'has-error': userForm.Age.$invalid && userForm.Age.$dirty}">
<label class="control-label">Age</label>
<input type="text" class="form-control" name="Age" ng-model="user.Age" placeholder="Age (Optional)" ng-model-options="{updateOn: 'blur'}" />
</div>
</div>
<div class="row col-lg-offset-3">
<div class="form-group col-lg-6" ng-class="{ 'has-error': userForm.Company.$invalid && userForm.Company.$dirty}">
<label class="control-label">Company</label>
<input type="text" class="form-control" name="Company" ng-model="user.Company" placeholder="Company Name (Optional)" ng-minlength="2" />
</div>
</div>
<div class="row col-lg-offset-3">
<!-- <button class="btn btn-primary"
ng-disabled="userForm.$invalid"
type="submit">Save</button>-->
<input type="submit" value="Submit">
</div>
</form>
</body>
</html>
我不認爲你想要做什麼是可能的,你需要一個後端腳本來發送實際的電子郵件。看到這裏:http://stackoverflow.com/questions/12626940/mailto-on-submit-button –