如何在angularjs中获取标签文本 [英] how to fetch label text in angularjs
问题描述
大家好,
我有asp.net网站,
其中我是使用anuglarJS。
情景
i有一个'Price'标签,在这里我使用ng-模型来获取它的价值,但不幸的是我没有得到它的价值,可能是它的标签bcoz。
ni有'qty'的文本框在这里我还使用了ng-model,它的工作。
n TotalPrice n的一个标签我在这里使用了ng-bind,这个也用了。
唯一的例子是:ng-model不能使用标签。
< asp:标签ID =lblpricerunat =serverText =4ng-model =ePrice>< / asp:Label>
< asp:TextBox ID =txteqtyrunat =serverng-model =Qty/>
< asp:Label ID =lbletpricerunat =serverng-bind =ePrice * Qty>< / asp:Label>
如何使用AnuglarJS获得标签的价值。
任何人都可以帮我解决这个问题...... 。
谢谢
试用此代码,
< div ng-app = ng-init = ePrice = 5 >
< asp:标签ID = Label1 runat = server ng-bind = ePrice > < / asp:标签 >
< asp:TextBox ID = TextBox1 runat = server ng-model = 数量 > < / asp:TextBox >
< asp:Label ID = Label2 runat = < span class =code-string> server Text = ng-bind = ePrice *数量 > < / asp:标签 >
< / div >
Hi guys,
I have asp.net website,
In which i'm using anuglarJS.
Scenario
i have one Label for 'Price', n here i used ng-model to fetch its value, but unfortunately i'm not getting its value, may be bcoz of it's a label.
n i have text box for 'qty' n here i also used ng-model, its working.
n one label for TotalPrice n here i used ng-bind, n this one is also working.
The only thing is: ng-model is not working with label.
<asp:Label ID="lblprice" runat="server" Text="4" ng-model="ePrice"></asp:Label> <asp:TextBox ID="txteqty" runat="server" ng-model="Qty" /> <asp:Label ID="lbletprice" runat="server" ng-bind="ePrice * Qty"></asp:Label>
how can i get the value of a label using AnuglarJS.
Can any one plz help me to solve this....
Thanks
Try this Code,
<div ng-app="" ng-init="ePrice=5"> <asp:Label ID="Label1" runat="server" ng-bind="ePrice"></asp:Label> <asp:TextBox ID="TextBox1" runat="server" ng-model="Qty"></asp:TextBox> <asp:Label ID="Label2" runat="server" Text="" ng-bind="ePrice*Qty" ></asp:Label> </div>
这篇关于如何在angularjs中获取标签文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!