Thursday, October 5, 2017

How to send ng-repeat index to another ng-repeat

I have an array call “Menu”

var Menu = [
        "url" : "#",
        "type" : "F",
        "id" : "F00001",
        "name" : "CUST",
        "child" : [ {
            "type" : "P",
            "id" : "C00001",
            "name" : "CUST INFO"
        }, {
            "type" : "P",
            "id" : "C00002",
            "name" : "CUST BACKGROUND"
        } ]

when the TopMenuBar click the “CUST” I expected the select index can put in another ng-repeat like this code below

<div id"TopMenuBar">    
    <ul>
        <li ng-repeat="row in Menu" >
            <a ng-click="row.type == 'P' ? GeneratePage({'txnName':row.name,'txnId':row.id,'txnPath':[row.name],'txnURL':[row.url]}) : angular.noop ></a></span>
        </li>
    </ul>
 </div>
 <div id="sideMenuContainer">
    <ul>
        <li ng-repeat="row2 in Menu[index].child" >
            <a ng-click="row.type == 'P' ? GeneratePage({'txnName':row2.name,'txnId':row2.id,'txnPath':[row2.name],'txnURL':[row2.url]}) : angular.noop ></a></span>
        </li>
    </ul>
</div>

THANKS for the answer

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/10/05/how-to-send-ng-repeat-index-to-another-ng-repeat/
via @lzomedia #developer #freelance #web #lzomedia.com

No comments:

Post a Comment