Pass Array<string> to @Prop


I have a component which has a:

@Prop() values: Array<string>;

Passing an array like this:

<fefe-dropdown values="['value1', 'value2']">

Seems to not work. Any Idea?


maybe (not sure)

<fefe-dropdown [values]="['value1', 'value2']">


 <fefe-dropdown values="{{['value1', 'value2']}}">


doesn’t seem to work: I found a solution from a guy on slack who helped me:


Matthias Max:

remember talking about this and the solution I think was to JSON.parse the input in case it is a string.
Thats a little downside I believe with custom elements used natively without other frameworks around it.

So I send a string in json format that I later parse to a json object and then use in my component.


weird but good to know

I know it works with an object I thought it would work with an array too

For example my component takes an object as input

<web-social-share ... [share]="myOptions"...

where myOptions is initialized in my ts code like

this.myOptions = {
            config: [{

but cool cool if you found a solution


Is that possible if your component is declared in the index.html?


It should make any difference no?


brackets around your property won’t work, I guess?



not sure I understand your question, my property is an object not an array so where should I use brackets?