Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9201171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:56:30+00:00 2026-06-17T22:56:30+00:00

I have two directives one which translates strings and one which creates a container

  • 0

I have two directives one which translates strings and one which creates a container with a title. (and some other functionality that was removed to make the example shorter)

Groupbox:

myapp.directive('groupbox', function () {
    return {
        restrict: 'E',
        priority: 200,
        template:
            '<fieldset>' +
            '<legend data-translate>{{title}}</legend>' +
            '<div data-ng-transclude></div>' +
            '</fieldset>',
        transclude: true,
        replace: true,
        scope: {title: '@'}
    };
});

Translate: (also simplified)

myapp.directive('translate', ['$filter', function ($filter) {
    return {
        restrict: 'A',
        link: function (scope, element, attrs) {
            var e = $(element);
            var data = attrs.translate;

            var results = $filter('I')(e.html(), data);
            e.html(results.text);
            if (results.tooltip) e.attr('data-tooltip', results.tooltip);
        }
    };
}]);

I use it like this:

<groupbox title='settings'>
   content
</groupbox>

The idea is that the content of the “groupbox” gets put in the div and the title in the “legend”. After this the legend needs to be translated by the translate directive. This translation does not happen (it just prints settings). When i replace ‘{{title}}’ with ‘settings’ it does get translated.

How can i get the translate directive to operate on the results of the groupbox directive.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:56:31+00:00Added an answer on June 17, 2026 at 10:56 pm

    I fixed it by adding a compile function that puts the title in the legend directly (without binding). That way it is no different then any other use of my translate directive.

    myapp.directive('groupbox', function () {
        return {
            restrict: 'E',
            transclude: true,
            replace: true,
            template:
                '<fieldset>' +
                    '<legend>' +
                        '<span data-translate></span> - ' +
                        '<a data-ng-click="open = !open" data-translate>toggle</a>' +
                    '</legend>' +
                    '<div data-ng-show="open" data-ng-transclude></div>' +
                '</fieldset>',
            compile: function(element, attrs) {
                element.children('legend').children('span').html(attrs.title);
            }
        };
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two classes (MVC view model) which inherits from one abstract base class.
I have one y variable, which I am trying to plot against two related
I have a web-application which is dependent on two other modules. For simplicity let's
I have a plunker here that demostrates it . I can create two directives.
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two queries that find both the Zip codes, and the States for
I need some advice in the following matter: I have a QT project, which
I have a website that has a folder for images. I have two problems:
I have two virtual hosts in httpd.conf one for port 443 and one for
I have two same project in which I have two classes under same namespace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.