krishna mohan
krishna mohan

Reputation: 921

unable to find percentage in angularjs

i have 4 text boxes. qty, unitprice, total and vat. im able get total price but unable to get vat percentage which is totalsum/100* 5. while putting ng-model to totalprice. its text is not coming.how to get total and form that total 5 percent of total value

<table>
<tr>
    <td>
        <asp:Label ID="Label5" Text="Qty : " runat="server"></asp:Label>
    </td>
    <td>
        <asp:TextBox runat="server" ID="txtQty"  ng-model="qty"/>
    </td>
</tr>
<tr>
    <td>
        <asp:Label ID="Label6" Text="Unit Price : " runat="server"></asp:Label>
    </td>
    <td>
        <asp:TextBox runat="server" ID="txtUnitPrice" ng-model="unitprice"/>
    </td>
</tr>
<tr>
    <td>
        <asp:Label ID="Label7" Text="Total Price : " runat="server"></asp:Label>
    </td>
    <td>
        <asp:TextBox runat="server" ID="txttotalprice"  Text="{{qty*unitprice}}" ng-model="TotalPrice/>
    </td>
</tr>
<tr>
    <td>
        <asp:Label ID="Label8" Text="VAT @ 5% : " runat="server"></asp:Label>
    </td>
    <td>
        <asp:TextBox runat="server" ID="txtVatPrice" Text="{{TotalPrice/100 * 5}}" />
    </td>
</tr>

Upvotes: 0

Views: 51

Answers (2)

Shankar Gurav
Shankar Gurav

Reputation: 1067

You need to use ng-model and ng-bind like this,

<input type="text" runat="server" ID="txttotalprice" ng-model="totalprice" ng-bind="{{totalprice= qty*unitprice }}" />

Check this plunker for more details.

Upvotes: 1

krishna mohan
krishna mohan

Reputation: 921

   <tr>

                <td>
                    <asp:Label ID="Label5" Text="Qty : " runat="server"></asp:Label>
                </td>
                <td>

                    <asp:TextBox runat="server" ID="txtQty" Width="408px" ng-model="qty"/>
                </td>

            </tr>




            <tr>

                <td>
                    <asp:Label ID="Label6" Text="Unit Price : " runat="server"></asp:Label>
                </td>
                <td>

                    <asp:TextBox runat="server" ID="txtUnitPrice" Width="408px" ng-model="unitprice"/>
                </td>

            </tr>


              <tr>

                <td>
                    <asp:Label ID="Label7" Text="Total Price : " runat="server"></asp:Label>

                </td>
                <td>

                    <asp:TextBox runat="server" ID="txttotalprice" Width="408px" Text="{{qty*unitprice}}"/>
                </td>

            </tr>


              <tr>

                <td>
                    <asp:Label ID="Label8" Text="VAT @ 5% : " runat="server"></asp:Label>
                </td>
                <td>

                    <asp:TextBox runat="server" ID="txtVatPrice" Width="408px" Text="{{(qty*unitprice/100) * 5}}" />
                </td>

            </tr>

Upvotes: 0

Related Questions