myContacts", "sref": "contact.list" }, { "template": "my" /> myContacts", "sref": "contact.list" }, { "template": "my" /> myContacts", "sref": "contact.list" }, { "template": "my"/>

Angular 1/$interpolate - interpolate array

100 Views Asked by At

I have this array stateData.submenu :

    [
      {
        "template": "<span translate>myContacts</span>",
        "sref": "contact.list"
      },
      {
        "template": "<span translate>myProjects</span>",
        "sref": "project.list"
      },
      {
        "template": "<span translate>myRecommendations</span>
          <span class=\"badge\">{{ notificationBadge }}</span>",
        "sref": "recommendation.list"
      }
    ]

I would like to interpolate all template properties with the service $interpolate I can interpret a single property for example with :

this.notificationBadge = this.$interpolate(stateData.submenu[2].template)(this)

How can I loop and interpolate all the properties using ecmaScript 2015 or Lodash for example ?

0

There are 0 best solutions below