I have a table with some data to view in html. when i do click print, i need to get all the data from db and print it. I am getting the data and populating the model data when i click on print, only the model is updated and print shows the old data. In the code below, newitems is not added to items when i click on print.
http://jsfiddle.net/vijaivp/Y3BJa/306/
HTML
<div ng-app>
<div class="hidden-print" ng-controller="PrintCtrl">
<br />
<div id="overallPrint" class='visible-print' style="float:left; margin-right:50px;">
<h4>Overall Report</h4>
<table border="1">
<thead>
<tr>
<td>Name</td>
<td>Price</td>
<td>Quantity</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in items">
<td>{{item.Name}}</td>
<td>{{item.Price}}</td>
<td>{{item.Quantity}}</td>
</tr>
</tbody>
</table>
<br>
<input type="button" value="Print Overall" ng-click='printOverallReport()' />
</div>
</div>
</div>
JS
function PrintCtrl($scope, $window, $q) {
$scope.items = [
{Name: "Soap", Price: "25", Quantity: "10"},
{Name: "Shaving cream", Price: "50", Quantity: "15"}
];
$scope.newitems = [
{Name: "Shampoo", Price: "100", Quantity: "5"}
];
$scope.printOverallReport = function () {
$scope.items.push($scope.newitems[0]);
$window.print();
};
}