2017-01-05 26 views
2

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.通行證或輸入文本值追加到<a href="sms?:body=">

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> 

更新

我已成功地在SMS錨文本輸入綁定,但是當我嘗試自來水在短信應用程序不能打開的按鈕上。這表明不安全:短信,但是當我嘗試只用HREF與示例文本(HREF =「短信:體=文本」),它開闢了短信應用

enter image description here

+0

所以要追加的輸入值href值:短信:體=推薦碼? – b3wii

+0

請添加更多的代碼並清晰地提出問題或創建一個plunkr。 – superUser

+0

基本上文本框內的值會傳遞給短信本體消息 – clestcruz

回答

1

您可以使用ngHref追加它到你的鏈接。

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

參見:https://docs.angularjs.org/api/ng/directive/ngHref

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

+0

你好斯蒂芬,謝謝你的提示。我設法將輸入框上的值綁定到錨點標籤上,但是當我使用ng-href點擊錨點元素時,似乎無法打開短信。如果我只使用href,它似乎打開短信應用程序 – clestcruz

相關問題