Dynamically Create UI Elements

Hi!

I wonder if there’s a way to dynamically create UI elements like sliders.

This would be helpful in the following use case: Assume you want to plot a polynomial and you want to let the user decide which degree N it should have.

y(x) = \sum_n^N a_n x^n

The idea now would be that you have a slider that would let you choose a value for N. This should then generate N sliders that would let you choose values for the parameter a_n.

I tried to do this with

a = zeros(N)
for i in 1:N
	@bind a[i] Slider(-1:0.1:1)
end

however, that throws an error.

I wonder if someone has a solution for this?