0

I am having issues with angular material tabs, i need to remove tabs on other side of html, not to wrap in entire html. Here is example with default tabs that is working ok

<md-content>
    <md-tabs md-dynamic-height md-border-bottom>
        <md-tab label="1">
            <md-content class="md-padding">1</md-content>
           </md-tab>
        <md-tab label="2">
            <md-content class="md-padding">2</md-content>
        </md-tab>
</md-tabs>
</md-content>

But i need to have something like this

<md-tabs md-dynamic-height md-border-bottom>
    <md-tab label="1">
    </md-tab>
    <md-tab label="2">
    </md-tab>
</md-tabs>


<div class="main">
    <md-content class="md-padding">1</md-content>
    <md-content class="md-padding">2</md-content>
</div>

I know there is option on

**md-on-select="" md-on-deselect=""**

But how to make it in my case?

2
  • Why do you need this can you explain? Can you provide a user story? Commented Oct 3, 2016 at 8:07
  • Because i need some custom element in html because of design Commented Oct 3, 2016 at 8:08

1 Answer 1

2

Here you go - CodePen

Link the md-selected attribute of the md-tabs with ng-switch on the main div.

Markup

<div ng-controller="AppCtrl as vm" ng-cloak="" ng-app="MyApp">
  <md-tabs md-dynamic-height md-border-bottom md-selected="vm.selectedIndex">
      <md-tab label="1">
      </md-tab>
      <md-tab label="2">
      </md-tab>
  </md-tabs>

  <div class="main" ng-switch="vm.selectedIndex">
      <md-content class="md-padding" ng-switch-when="0">1</md-content>
      <md-content class="md-padding" ng-switch-when="1">2</md-content>
  </div>
</div>

JS

angular.module('MyApp',['ngMaterial'])

.controller('AppCtrl', function() {
  this.selectedIndex = 0;
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.