im trying to call a simple function in angularjs, but when im calling the function from the controller, the app crash. for example, if i call the function from ng-click event, everything is working fine.
the code is about json object array that i want to push his data to another array
the code:
$scope.imgindex=[];
$scope.makeindex = function()
{
for(var i=0;i<$scope.zimmers.length;i++)
{
$scope.imgindex.push({id:$scope.zimmers[i]['ZimmerID'],index:0});
}
}
makeindex();