Lightning: How to change page title for lightning app?

Could you please share an idea how to change page title for lightning app?


Today you can add this:

document.title = “Your Title”;

in your .app’s init handler:

<aura:handler value="{!this}" name="init" action="{!c.init}"/>

in your app’s controller:

init: function(component, event, helper) {
   document.title = "Your Title";

This happens a bit later than you would like so you will see Aura in the title for a short interval and then it gets replaced with Your Title.

There is a new feature being exposed in Lightning Components soon that lets you customize the app’s “template” markup that will make this both trivial and eliminate the Aura -> Your Title “flash”. template= for apps exists already in Aura open source so you can read about it at least – we were waiting on a few changes to the way templates work before exposing them via Lightning where we have to support them in a push update world. See Creating App Templates to get a preview of what is coming to LC.

Source : Link , Question Author : Natallia , Answer Author : Doug Chasman

Leave a Comment