The following is my code:
I would like to get the parameters from the url and print it out in the webpage.
For example, http://127.0.0.1:8051/random?xaxis=log&yaxis=log is my url.
I want to print out the pathname in the webpage, while I get return as None now. Where am I going wrong.
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
app = dash.Dash(__name__)
app.layout = html.Div([
dcc.Location(id='url', refresh=False),
html.Br(),
html.Div(id='my-output')])
@app.callback(
Output(component_id='my-output', component_property='children'),
Input(component_id='url', component_property='value'))
def update_output_div(value):
return html.Div([
html.H1('path is {}'.format(str(value)))
])
if __name__ == '__main__':
app.run_server(debug=True, port= 8051)
I get the output as