ng-init with ng-repeat not working

I am trying to display some numbers in a div using as like below

 <div ng-init="range=[1,10,3,4,5]" ng-repeat="n in range" >

It is not showing the numbers in range


Initialize before ng-repeat

<div ng-init="range=[1,10,3,4,5]" >
<div ng-repeat="n in range" >

Fiddle for solution:

Initialize the values before ng-repeat

<div ng-init="range=[1,10,3,4,5]"></div>
<div ng-repeat="n in range" >


ng-init should only be used for aliasing:

Can you not initialise the range value in your controller?

Try this one

<!DOCTYPE html>
<html ng-app>
    <script type="text/javascript"

    <ANY ng-init="range=[1,10,3,4,5]">
    <div ng-repeat="n in range">

Need Your Help

Moment.js - how do I get the number of years since a date, not rounded up?

javascript date momentjs

I'm trying to calculate a person's age using Moment.js, but I'm finding that the otherwise useful fromNow method rounds up the years. For instance, if today is 12/27/2012 and the person's birth dat...

Converting XElement to HTML string

html xml linq scripting xelement

I am performing XML Operations on an XHTML document utilizing Xml and Linq.