How to evaluate Expression inside Expression in AngularJS -


i trying evaluate expression inside expression using angularjs.please let me know how it?

problem:

i have 2 objects department , facility , want display departments , facilities in accordions. so, able pass department object , facility object. problem arises.as department object has property department_name , facility has facility_name.i passed department_name , facility_name label attribute in directive , trying use in accordion html {{item.{{label}}}}.i don't think right. please let me know how can this.

thanks in advance

in html:

 <accordion-directive object="department" label="department_name">  </accordion-directive>  <accordion-directive object="facility" label="facility_name"> </accordion-directive> 

in accordion html

 <accordion-group ng-repeat="item in object>  <accordion-heading> {{item.{{label}}}} // departments should  department[0].department_name                  // facility should facility[0].facility_name   </accordion-heading> </accordion-group> 

json file:

    {    "department": [                    {                      "department_name": "department 1",                     },                   {                    "department_name": "department 2",                   }                   ]         }         {     "facility": [                    {                     "facility_name": "facility 1"                    },                    {                     "facility_name": "facility 2"                    }                 ] } 

directive:

          angular.module("app").directive('accorddirective', function () {            return {            restrict: 'e',              scope: {                object: '=',                label:'@'               },              templateurl: 'accordian.html',             } 

use square brackets:

{{item[label]}} 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -