1

We have a project contains a lot of HTML files. Unfortunately, we have recognized we should have used lang tag for our HTML files. We use AngularJS and Java.

Is there any way to set all pages HTML lang?

Veve
  • 6,643
  • 5
  • 39
  • 58
xxlali
  • 996
  • 2
  • 15
  • 43

1 Answers1

3

You can use a simple directive:

myApp.directive('html', [function() {
    return {
        restrict: 'E',
        link : function(scope, element, attrs) {
            attrs.$set("lang", "en");    // Set the "lang" value dynamically here
        }
    };
}]);

Just make sure the app is initialized at html tag i.e. <html ng-app> and you don't have to do this in your every page.

Shashank Agrawal
  • 25,161
  • 11
  • 89
  • 121