cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div class="container" ng-app="invoice">
  <section class="jumbotron">
    <h1>AngularJS invoice example</h1>
    <p>Createing simple invoice example by Amro Eldewiny - Arabic HTML</p>
    <p>Add more invoice as you like.</p>
  </section>
  <section class="row" ng-controller="InvoiceController">
    <table class="table table-hover">
      <thead>
        <tr>
          <th>Name</th>
          <th>Description</th>
          <th>Qty</th>
          <th>Price</th>
          <th>Total</th>
          <th>Delete</th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="item in invoice.items">
          <td><input type="text" ng-model="item.name" class="form-control" /></td>
          <td><input type="text" ng-model="item.description" class="form-control" /></td>
          <td><input type="number" ng-model="item.qty" class="form-control" /></td>
          <td><input type="number" ng-model="item.price" class="form-control" /></td>
          <td>{{item.qty * item.price}} €</td>
          <td><button type="button" class="btn btn-danger" ng-click="remove($index)">Delete</button></td>
        </tr>
        <tr>
        <td><button type="button" class="btn btn-primary" ng-click="add()">Add item</button></td>
          <td></td>
          <td></td>
          <td>Total : </td>
          <td>{{total()}} €</td>
        </tr>
      </tbody>
    </table>
  </section>
</div>
            
          
!
            
              var invoice = angular.module('invoice', []);
invoice.controller('InvoiceController', function($scope){
  $scope.invoice = {
    items: [{
      name: 'item',
      description: 'item description',
      qty: 5,
      price: 5.5
    }]
  };
  $scope.add = function(){
    $scope.invoice.items.push({
      name: '',
      description: '',
      qty: 1,
      price: 0
    });
  },
    $scope.remove = function(index){
    $scope.invoice.items.splice(index, 1);
  },
    $scope.total = function(){
    var total = 0;
    angular.forEach($scope.invoice.items, function(item){
      total += item.qty * item.price;
    })
    return total;
  }
});
            
          
!
999px
Loading ..................

Console