Both the ng-repeat's are not working. But just showing {{ rows }} does work. So the communication between the template and the controller is working.
What's wrong with my ng-repeat?
I already searched the other posts on this topic, but on all of them the error was in the controller. But even repeating an I in an array defined in the HTML template isn't working. And the Rows are showing up when not looping.
<div ng-controller="OrderNewCtrl">
<h1> {{ rows }}</h1>
<div ng-repeat="i in [42, 42, 43, 43]">
{{ i }}
<p>test</p>
</div>
<div class="form">
<form>
<table>
<tbody>
<tr ng-repeat="rowContent in rows">
{{rowContent}}
</tr>
</tbody>
</table>
<button class="btn btn-primary btn-functionality btn-success btn-add" ng-click="addRow">+</button>
</form>
</div>
</div>
'use strict';
angular.module('myApp.orderNew', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/order/new', {
templateUrl: 'order-new/order-new.template.html',
controller: 'OrderNewCtrl'
});
}])
.controller('OrderNewCtrl', function($scope) {
$scope.rows = ['Row 1', 'Row 2', 'Row 3', 'Row 4'];
$scope.counter = 4;
$scope.test = "hi";
$scope.addRow = function() {
$scope.rows.push('Row ' + $scope.counter);
$scope.counter++;
}
});