Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Learn how we can repeat html element without using any conditional loop

    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 827
    Comment on it

    Hii,
    Learn how we can repeat html element without using any conditional loop by using AngularJs.
    To repeat html elements using AngularJs we use ng-repeat which is a directive of AngularJs, ng-repeat directive is used to repeat an HTML element.

    Go through this simple example to learn how we can use ng-repeat i.e an AngularJs directive 
    Example:In this example ng-app(To initialise an AngularJS application),ng-init(To initialise application data),ng-repeat(To repeat HTMl element) directives and an expression {{expression}} (to bind data to HTML) are used.

    <div ng-app="" ng-init='week=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]'>
      <p>List of days in a week using ng-repeat directive</p>
      <ul>
        <li ng-repeat="days in week">
          {{ days }}
        </li>
      </ul>
    </div>

    Output:
    List of days in a week using ng-repeat directive

    •     Monday
    •     Tuesday
    •     Wednesday
    •     Thursday
    •     Friday
    •     Saturday
    •     Sunday 

    Note: Must include this link in your file

    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> 

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: