1

I have a search tool built out. I want the search bar to prepopulate with search terms from the URL, cant seem to get it to work though.

<aura:attribute name="searchVar" type="String"/>
<div class="slds" style="margin-top:10px;margin-left:10px;">
        <ui:inputText class="form-control" value="{!v.searchVar}"
                      placeholder="Search"/>

I was expecting to be able to populate using ..

/appname.app?searchVar=SearchTerms
8
  • check this post.. in lightning component you want populate value using url hack check this post... salesforce.stackexchange.com/questions/117208/… – Ratan Paul Apr 15 '16 at 12:59
  • Possible duplicate of Lightning App - getting URL parameter – Ratan Paul Apr 15 '16 at 13:08
  • This will only work is the attribute is defined in the .app. What is I want to pass the parameter to a nested component? – Allen Mann Apr 15 '16 at 13:20
  • Can you please update your question with desire requirement else it is marked as duplicate. And Related to nested component I believe only solution to pass in url and assign to attribute another solution can be use javascript to get the values from url and assign it to any attribute etc... – Ratan Paul Apr 15 '16 at 13:25
  • 2
    If URL hacking won't work in a lightning component to begin with, how are you expecting it to work in a nested component? – crmprogdev Apr 15 '16 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.