Error passing server variable to edge component


#1

How to pass controller parameter to edge component.

@!component(‘components.datatable’,id=“dataTable”,total={{total}})

Component code is

console.log("{{total}}")

where “total” is what i set as return from controller.

return view.render(‘home.sites’,{“total”:13})

No error is thrown, but the value is empty inside component. whereas its correct value in .edge file


#2

Can you please format your codeblocks properly :pray:

Interpolation is used when you are using variables inside raw text and not when using tags.

@!component('components.datatable', id='dataTable', total=total)

#3

Thank you @virk, it worked.