I am trying to print comma seperated values with successive loops but getting double comma.
Update:
Suppose i have data like this in my array:
var carModel = [model:"1",model:"2"];
var carNames = [Name:"Abc",Name:"Xyz"];
var Price = 1000;
Expected output:
1 as Car1,2 as Car2,Abc as Name1,Xyz as Name2,1000 as price
Code:
<div ng-repeat="data in carModel">
{{data.model}}
<div>as</div>
Car{{ $index + 1 }}
<span ng-if="!$last">,</span>
</div>
<div ng-repeat="data in carNames">
{{data.Name}}
<div>as</div>
Car{{ $index + 1 }}
<span ng-if="!$last">,</span>
</div>
<span ng-if="carModel.length > 0 || carNames.length > 0" > , </span>
<div>
{{ Price }}
<div>as</div> price
</div>
Now this gives me below output which contains double comma:
1 as Car1,2 as Car2,Abc as Name1,,Xyz as Name2,1000 as price