DEV Community

[Comment from a deleted post]
Collapse
 
daviddalbusco profile image
David Dal Busco • Edited

Hi,

First thing I notice in the related code/article you posted, as far as I know, you can't pass an array as property of your component in html (<list-component list-object='[... don't work I think). For complex type you have to use javascript. Here you will find an example on how to do that, see property share: github.com/fluster/web-social-shar...

Then I would remove the @Watch('listObject'), I don't think you could have a watch method with parameters. If you still want to use a watcher, try to remove the parameters of the function and do the job inside it.

If it still not works, maybe I would try to change the componentWillLoad in componentDidLoad

Final thought, I don't think you need a method to manipulate the Dom in order to create ul and li elements, you kind of don't use the power of the tool doing so. I would suggest to just iterate on your listObject, which btw. should be declare as an array (string[]) not a a string, in your render method and just render the tags

Hope that helps, have fun

Collapse
 
vasanthanaidu profile image
PVNaidu

Hi David,

Thank you for the inputs, its very helpful. let me try to fix.