[SalesForce] lightning:isUrlAddressable pageReference returns null

I'm trying to use the new lightning:isUrlAddressable interface to pass a few variables into a lightning component that is inside a lightning tab. In the init function I try to get the pageRefernce with the code

var myPageRef = component.get("v.pageReference");
console.log(myPageRef);

myPageRef will only return null right now and I'm not sure why. I have made sure the api version is 43. I am loading some other scripts into the page as well and I have tried getting the pageReference before and after loading the scripts. with no change.

<ltng:require styles="{!join(',', 
                            $Resource.FSL__FontAwesome44 + '/css/font-awesome.min.css')}"
              scripts="{!join(',', 
                            $Resource.jquery_3_1_0_min, 
                            $Resource.bootstrapNew + '/bootstrap-3.3.7-dist/js/moment.js',
                            $Resource.bootstrapNew + '/bootstrap-3.3.7-dist/js/bootstrap.datepicker.js')}"
              afterScriptsLoaded="{!c.jsLoaded}" />

I have also tried including

<lightning:workspaceAPI aura:id="workspace"/>
<lightning:navigation aura:id="navService"/>

but neither seems to have any effect and I don't think they should from what I know about them.

Has anyone else had any problems with this interface?

Best Answer

I had a similar issue, it constantly returns null if the component is being used on a flexipage (this isn't supported, see documentation https://developer.salesforce.com/docs/component-library/bundle/lightning:hasPageReference/documentation).

Related Topic