AngularJS empty fiddle
AngularJS empty fiddle
HTML
<div ng-app="myApp" ng-controller="Ctrl">
<table >
<tr ng-repeat="r in layout">
<td ng-repeat="c in r" ><input ng-if="checkIt(c.seat_no)" ng-model="c.seat_no" style="width:20px;"></td>
</tr>
</table>
</div>
JavaScript
var app = angular.module('myApp', []);
app.controller('Ctrl',['$scope',function($scope) {
var row = 11;
var col = 5;
var div = 3;
var counter = 1;
$scope.layout = [];
for(var i =0; i < row; i++){
$scope.layout[i] = [];
for(var j = 0; j< col; j++){
if(j != div-1 || i == row-1 ) {
var seat = {
seat_no:counter++,
type:"VIP"
}
} else {
var seat = {
seat_no: false
}
}
$scope.layout[i].push(seat);
}
}
$scope.checkIt = function (seat){
console.log(seat.typeof);
if(seat){
return true;
} else {
return false;
}
}
console.log($scope.layout);
}]);