Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

AngularJS For Loop with Numbers & Ranges

Asked by Anil Mer Jul 17, 2021 943 views 1 answer
Share

About this question

Angular does provide some support for a for loop using numbers within its HTML directives:
 
 do something

But if your scope variable includes a range that has a dynamic number then you will need to create an empty array each time.

In the controller

var range = []; 
for(var i=0;i   range.push(i); 
} 
$scope.range = range;

In the HTML


  do something 

This works, but it is unnecessary since we won't be using the range array at all within the loop. Does anyone know of setting a range or a regular for min/max value?

Something like:

 
   do something 

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.