title: how to highlight the selected menu in angular 4
body: <p>I am trying to highlight the selected menu but unable to get an idea.</p>
  
  <p>Below code is menu with sub-menus, menus come from JSON.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div *ngFor="let values of val"&gt;
      &lt;mat-expansion-panel class="mat-ripple" mat-button routerLink="."&gt;
          &lt;mat-expansion-panel-header expandedHeight="48px" collapsedHeight="48px"&gt;
              &lt;mat-panel-title&gt;
                  &lt;md-icon class="mat-icon mat-list-icon material-icons"&gt;
                      {{values.titleImage}}
                  &lt;/md-icon&gt;
                  &lt;div class="menu-list-text"&gt;
                      {{values.titleName}}
                  &lt;/div&gt;
              &lt;/mat-panel-title&gt;
          &lt;/mat-expansion-panel-header&gt;
          &lt;a class="sidenav-link mat-list-item mat-ripple"
             mat-button
             routerLink="."
             *ngFor="let subTitleVal of values.subTitle"&gt;
              &lt;div class="mat-list-item-content"&gt;
                  &lt;span md-line=""&gt;{{subTitleVal.titleName}}&lt;/span&gt;
              &lt;/div&gt;
          &lt;/a&gt;
      &lt;/mat-expansion-panel&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>JSON</strong></p>
  
  <pre><code>val: any;
  val = [{
      'titleKey': 'AAA',
      'titleName': ' Menu1',
      'titleImage': 'Icon1',
      'subTitle': [{
          'titleKey': 'AAA',
          'titleName': 'SubMenu1',
          'action': 'ACC',
      }]
  }, {
      'titleKey': 'BBB',
      'titleName': 'Menu2',
      'titleImage': 'Icon2',
      'subTitle': [{
          'titleKey': 'BBB',
          'titleName': 'SubMenu2',
          'action': 'FT',
      }]
  }, {
      'titleKey': 'CCC',
      'titleName': 'Menu3',
      'titleImage': 'Icon3',
      'subTitle': [{
          'titleKey': 'CCC',
          'titleName': 'SubMenu3',
          'action': 'BP',
      }]
  }];
  </code></pre>
  
  <p>How to add the class when user selects a particular sub-menu?</p>