In my application, I'm using NodeJS, Express in the backend and Angular in the frontend. I'm also using Jade template engine.
jade obtains a variable called "adv" by this code.
res.render('page',{adv:result[0]})
In controller.js (for angular)
$scope.content = [];
I would like to do something like
form(ng-init="content=#{adv}")
h5 {{"content" + content}}
i.e. assign that jade variable to the scope. It is not working. I could use http.get and get the content directly to angular scope, but just wondering if it is possible to do this
Thanks
$scope.adv = result[0]?form(ng-init="content=#{adv}")ends up as<form ng-init="content=[object]">so it looks like there are two problems at play here. First, jade seems to renderresult[0]as a JSON object and not a string (maybe try to stringify it?) and second I am pretty sure you need to use single-quotes withng-initif you want to assign a constant and not a variable.