0

Here i am trying to multiply both ticketPrice(ng-model) and selceted numberOfTickets(ng-model) but i am always getting NAN as total

<tr>
     <td ng-model="ticketPrice">5</td>
     <td>
       <select class="form-control" ng-model="numberOfTickets" 
            ng-options="n for n in [] | range:1:15"  >
           <option value="">--Select No. of Tickets--</option>                                                    
       </select>
     </td>
     <td class="text-primary text-center"><strong ng-model="ticketsTotalPrice">{{ ticketPrice * numberOfTickets }} </strong></td>
    </tr>

Please give a solution

Thank you!

3
  • The ng-model directive does not work with <td> elements. Commented Jan 31, 2017 at 6:52
  • HI @georgeawg try this <span ng-init="price=100" ></span> Commented Jan 31, 2017 at 7:06
  • then what should i use for ticket price? Commented Jan 31, 2017 at 7:07

2 Answers 2

1

click here to check fiddle example

<span ng-init="price=100" ></span>
<select name="" id="" ng-model="noOfTic">
  <option value="" selected>select ticket</option>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
</select>
{{price * noOfTic}}

Fiddle link

Sign up to request clarification or add additional context in comments.

1 Comment

ng-model="ticketPrice" is dynamic
0

Use ng-bind not ng-model

<strong ng-bind="ticketPrice * numberOfTickets"></strong>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.