Skip to content

how to use translate with directive (JSON keys are not getting translated) #187

@vkkmehra

Description

@vkkmehra

I am using the exact versions of the following:

  • Browser: [Chome] Version: 67.0.3396.87
  • AngularJS: 1.5.8
  • Angular Bootstrap: 3.3.7
  • Angular UI Tour: 0.9.2

I have installed this library via: (Bower)

I have observed the following behavior:

in my en.json file i have defined key as

"agentTour": {
    "step1Title": "Branch Office"
}

I have even tried by using a variable in my controller as
vm.test = 1;

and using it in the directive as tour-step tour-step-title="vm.test" or tour-step tour-step-title="{{vm.test}}"

but the variables print as it is if I use {{}} then nothing shoes up.

This is how I expected it to behave:
I expected it to replace the step1Title with Branch Office

Here is my tour config, and all related step configs:

var tourPromise = uiTourService.getTour().start();
<div ui-tour ui-tour-backdrop="true" ui-tour-scroll-into-view="true" ui-tour-append-to-body="true" ui-tour-on-shown="vm.tourStart()" on-end="vm.tourEnd()">
                <div class='row' id='agentStep1' ng-hide="vm.alreadyParent" id="mainMenu" tour-step tour-step-title="{{vm.tourTitle}}" tour-step-content="Navigate the site using this menu." tour-step-order="0" tour-step-placement="top" tour-step-backdrop="true">
                    <fe-lib-check-box class="col-xs-12 col-sm-3 mt-20" placeholder="Agent.chkAgentBranchOffice" data-ng-model="vm.agent.is_branch_office" data-ng-disabled="vm.agent.TotalBranchOffices>0">
                    </fe-lib-check-box>

                    <fe-lib-typeahead on-item-selected="vm.changeValues" class="col-xs-12 col-sm-8" data-ng-model="vm.agentParentAgent" text-field="agent_name" api-route="{{vm.routeOfParentAgent}}" display-properties=" agent_name " placeholder="{{'Agent.dpdAgentParentAgent' | translate}}" readonly="!vm.agent.is_branch_office" required="vm.agent.is_branch_office">
                    </fe-lib-typeahead>
                </div>

Additional notes/code:

Also if you can give me an example to define tour steps in the controller as it is also not working for me

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions