Reputation: 595
I am trying to add some text to the current title in shiny app. So I used
paste("Hello Shiny!", textOutput("text1"))
in the title but unfortunately something is wrong. The output and R code are as follows:
library(shiny)
ui <- fluidPage(
titlePanel(
title=
#textOutput("text1")#
paste("Hello Shiny!", textOutput("text1")))
)
server <- function(input, output) {
output$text1<-renderText({"Title changed dynamically"})
}
shinyApp(ui = ui, server = server)
What's wrong with the code?
Upvotes: 1
Views: 299
Reputation: 388982
Paste the data on the server side -
library(shiny)
ui <- fluidPage(
titlePanel(
title= textOutput("text1"))
)
server <- function(input, output) {
output$text1<-renderText({
dynamic_title <- "Title changed dynamically"
paste("Hello Shiny!", dynamic_title)})
}
shinyApp(ui = ui, server = server)
Upvotes: 3