将输入文本中的值传递或附加到<a href="sms?:body=">

时间:2017-01-05 16:47:59

标签: javascript angularjs

I'm trying to look for a how I can pass the value from in input textbox *href="sms:?body" It is a dynamic value that changes every time a user creates a new account. The idea is that once I click on the "Send Invite by SMS" the value or referral code that is included in the input text will also be included in the SMS body message.

enter image description here

正在进行的示例工作

<input class="input" disabled="true" placeholder="Referral Code" ng-model="account.referral_code_string" id="input-refcode">

<a ng-model="account.referral_code_string" href="sms:?body=" class="sms-btn" >Send Invite by SMS</a>

更新

我已设法绑定短信主播上的输入文本,但是当我尝试点击该按钮时,短信应用程序无法打开。它显示不安全:短信,但当我尝试仅使用带有示例文本的href(href =“sms:?body = text”)时,它会打开短信应用

enter image description here

1 个答案:

答案 0 :(得分:1)

您可以使用ngHref将其附加到您的链接。

static public void GenerateOrder(string Time, string Date) { MySqlConnection conn = new MySqlConnection("server = localhost; uid = root; database = coursework; password = root;"); conn.Open(); MessageBox.Show(Date + Time); string statement = ("INSERT INTO order (CustomerID, Name, Date, Time, Price) VALUES(" + Users.UserID + ",'" + Users.Firstname + "','" + Date + "','" + Time + "'," + OrderPrice + ");"); MessageBox.Show(statement); MySqlCommand cmd = new MySqlCommand(statement, conn); cmd.ExecuteNonQuery(); MessageBox.Show("Order successfully placed."); conn.Close(); }

请参阅:https://docs.angularjs.org/api/ng/directive/ngHref

工作示例:http://plnkr.co/edit/3z145H?p=preview