HOW TO USE NG-REPEAT INSIDE NG-REPEAT IN ANGULARJS

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
 738  View(s)
Ratings:
Rate this:
We want to use ng-repeat inside ng-repeat in Angularjs.how will do this please tell  me.
  1. aditya kumar Patel

    Post:254

    Points:1810
    Re: How to use Ng-repeat inside ng-repeat in Angularjs

    @{

    Layout = null;

    }

    <!DOCTYPE html>

    <html>

    <head>

    <title>Forum</title>

    <meta name="viewport" content="width=device-width" />

    <script src="~/Scripts/jquery-1.9.1.js"></script>

    <script src="~/Scripts/angular.js"></script>

    <script>

    var app = angular.module("myApp", []);

    app.controller('MyCtrl', function ($scope) {

    $scope.menuItems = [{ Productname: 'Samsung Galaxy S6 Compare', category: 'SAMSUNG' },

    { Productname: 'Samsung Galaxy S6 Edge', category: 'SAMSUNG' },

    { Productname: 'Compare Samsung Galaxy Core ', category: 'SAMSUNG' },

    { Productname: 'Lenovo Vibe Shot', category: 'Lenovo' },

    { Productname: 'Lenovo A6000', category: 'Lenovo' },

    { Productname: 'Lenovo K3 Note', category: 'Lenovo' }

    ];

    $scope.categories = ['Lenovo', 'SAMSUNG']

    })

    </script>

    </head>

    <body ng-app="myApp" ng-controller="MyCtrl">

    <div>

    <ul ng-repeat="ca in categories">

    <li style="font-weight:bold;">{{ca}}</li>

    <li ng-repeat="menuItem in menuItems | filter:{category: ca}">{{menuItem.Productname}}</li>

    </ul>

    </div>

    </body>

    </html>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!