0
  <div class="row">
    <div class="col col-75">
      <label class="item item-input">           
        <input type="text" placeholder="Material Name" ng-model="thingstodo[0].mname">
      </label>
    </div>
    <div class="col">
      <label class="item item-input">
        <input type="number" placeholder="Rs" ng-maxlength="4" ng-model="thingstodo[0].cost">
      </label>
    </div>
  </div>
  <div class="row">
    <div class="col col-75">
      <label class="item item-input">
        <input type="text" placeholder="Material Name" ng-model="thingstodo[1].mname">
      </label>
    </div>
    <div class="col">
      <label class="item item-input">
        <input type="number" placeholder="Rs" ng-maxlength="4" ng-model="thingstodo[1].cost">
      </label>
    </div>
  </div>
  <div class="row">
    <div class="col col-75">
      <label class="item item-input">
        <input type="text" placeholder="Material Name" ng-model="thingstodo[2].mname">
      </label>
    </div>
    <div class="col">
      <label class="item item-input">
        <input type="number" placeholder="Rs" ng-maxlength="4" ng-model="thingstodo[2].cost">
      </label>
    </div>
  </div>
  <div class="row">
    <div class="col col-75">
      <label class="item item-input">
        <input type="text" placeholder="Material Name" ng-model="thingstodo[3].mname">
      </label>
    </div>
    <div class="col">
      <label class="item item-input">
        <input type="number" placeholder="Rs" ng-maxlength="4" ng-model="thingstodo[3].cost">
      </label>
    </div>
  </div>
  <div class="row">
    <div class="col col-75">
      <label class="item item-input">
        <input type="text" placeholder="Material Name" ng-model="thingstodo[4].mname">
      </label>
    </div>
    <div class="col">
      <label class="item item-input">
        <input type="number" placeholder="Rs" ng-maxlength="4" ng-model="thingstodo[4].cost">
      </label>
    </div>
  </div>
  <div class="row" data-ng-repeat="rowContent in rows">
    <div class="col col-75">
      <label class="item item-input">
        <input type="text" placeholder="Material Name" ng-model="thingstodo[rowContent].mname">
      </label>
    </div>
    <div class="col">
      <label class="item item-input">
        <input type="number" placeholder="Rs" ng-maxlength="4" ng-model="thingstodo[rowContent].cost">
      </label>
    </div>
  </div>
  <div class="row">
    <div class="col" align="center"> </div>
    <div class="col col-75" align="right"> <i class="font25 icon ion-ios-plus-outline" ng-click="addRow()"></i>&nbsp;&nbsp;&nbsp;<i class="font25 icon ion-ios-minus-outline" ng-click="deleteRow($index)"></i></div>
  </div>
  <div class="row">
    <div class="col col-75">
      <label class="item item-input">
        <input type="text" readonly value="Labour Charges">
      </label>
    </div>
    <div class="col">
      <label class="item item-input">
        <input type="number" placeholder="Rs" ng-maxlength="4" ng-model="thingstodo_additional.labourcost">
      </label>
    </div>
  </div>
  <div class="row">
    <div class="col col-75">
      <label class="item item-input">
        <input type="text" readonly value="Service Charges">
      </label>
    </div>
    <div class="col">
      <label class="item item-input">
        <input type="number" placeholder="Rs" ng-maxlength="4" ng-model="thingstodo_additional.servicecost">
      </label>
    </div>
  </div>
  <div class="row">
    <div class="col">
      <button class="button button-block button-balanced">0.00 RS</button>
    </div>
  </div>
  <div class="row">
    <div class="col">
      <button class="button button-block button-dark" ng-click="collectData()">Confirm</button>
    </div>
  </div>

I want to add the {{thingstodo[0].cost + thingstodo[1].cost + thingstodo[2].cost + thingstodo[3].cost + thingstodo[4].cost + thingstodo_additional.labourcost + thingstodo_additional.servicecost}} and also want to add the dynamic textbox value {{ thingstodo[rowContent].cost }}

2
  • Can't understand question add more information. Commented Oct 29, 2015 at 9:28
  • Should be clearly explained. Commented Oct 29, 2015 at 9:35

2 Answers 2

1

I'm not entirely sure what the question asking, but I shall try and give you an answer to help get the question.

If you are trying to simply add the costs as the numbers change - you don't need to use ng-change, you can have the numbers automatically computute using databinding:

See here: http://jsfiddle.net/AshCoolman/8qnxukuh/2/

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

3 Comments

Yes I got it but <input type="number" placeholder="Rs" ng-maxlength="4" ng-model="thingstodo[rowContent].cost"> row content is dynamic value how can add that text box value.
Hm. In the jsfiddle i provided, when you type new values into the two text boxes, it instanty (dynamically) adds them to create a new total. This is how I understood the question. Could you explain my misunderstanding if this is not what you are after?
<div class="row" data-ng-repeat="rowContent in rows"> <div class="col col-75"> <label class="item item-input"> <input type="text" placeholder="Material Name" ng-model="thingstodo[rowContent].mname"> </label> </div> <div class="col"> <label class="item item-input"> <input type="number" placeholder="Rs" ng-maxlength="4" ng-model="thingstodo[rowContent].cost"> </label> </div> </div>
1

I think that i know what you want.

Check this:

app.filter('range', function () {
    return function (input, total) {
        total = parseInt(total);
        for (var i = 0; i < total; i++)
            input.push(i);
        return input;
    };
});

Html:

<input type="number" placeholder="Rs" ng-maxlength="4" ng-model="rows">

<div ng-repeat="row in [] | range: rows">
   <input type="number" ng-model="thingstodo[$index].cost" />
</div>

Working demo: http://plnkr.co/edit/AbenOQGSSZyfCDVmd6ww

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.