material icon indicating copy to clipboard operation
material copied to clipboard

Tabs label one way binding not allowing translating their text

Open franciscopuyo opened this issue 11 years ago • 4 comments

Hi, when I change my site language it can't change tabs label text:

<md-tabs md-dynamic-height md-border-bottom>
        <md-tab>
            <md-tab-label><span>{{ 'DESCRIPTION' | translate }}</span></md-tab-label>
            <md-tab-body>
                <div class="text-description">
                {{ description }}
              </div>
        </md-tab-body>
        </md-tab>
</md-tabs>

I tried using md-tab label attribute and it continues without working. am i doing something wrong or is it a bug?

Thanks

franciscopuyo avatar Jun 09 '15 20:06 franciscopuyo

@franciscopuyo Can you provide a CodePen to demonstrate this? What you are doing looks right, so if it's not working, I will need to add a fix.

robertmesserle avatar Jun 11 '15 20:06 robertmesserle

@franciscopuyo This seems to be an issue with how filters work. This will work if you wrap your label in a function that applies the filter, but will not work with just the filter.

Sample: http://codepen.io/robertmesserle/pen/265ceab91d77537e3e39151a6835f5d5/?editors=001

robertmesserle avatar Jun 11 '15 22:06 robertmesserle

This seems to be how Angular works. The same problem exists even if you remove tabs altogether:

http://codepen.io/robertmesserle/pen/dd45876671285958d32acad27896a41a?editors=101

Closing for now, but maybe open an issue against AngularJS for this.

robertmesserle avatar Jun 11 '15 22:06 robertmesserle

Sorry, I tried to figure out how show it using codepen but I couldn't load all the dependecies.

I've also tried wrapping the label into a function but it doesn't work.

 $scope.translate = function() {
        return $scope.translation;
    }

    $rootScope.$on('$translateChangeSuccess', function () {
        $translate('DESCRIPTION').then(function (translation) {
            $scope.translation= translation;
        });
    });
<md-tabs md-dynamic-height md-border-bottom>
<md-tab>
            <md-tab-label>{{ translate() }}</md-tab-label>
            <md-tab-body>
                <div class="text-description">
                {{ description }}
              </div>
            </md-tab-body>
        </md-tab>
</md-tabs>

Do you have the issue code? so I can follow it.

Really thanks

franciscopuyo avatar Jun 12 '15 19:06 franciscopuyo