Questions tagged [ejs]

"E" is for "embedded." EJS is a simple templating language that lets you generate HTML markup with plain JavaScript. No religiousness about how to organize things. No reinvention of iteration and control-flow. It's just plain JavaScript.

Embedded JavaScript (EJS) is a set of two open source libraries providing in-browser client side templates for web development and as a template system for node.js (including client-side template functionality). EJS uses <% %> or [% %] tags, executing any JavaScript within the tags. Adding an equals sign (<%= %>) causes the enclosed JavaScript to be evaluated, and the toString representation to be appended to the document.

The original client-side EJS has been subsumed into JavaScriptMVC, official support is offered at their forum (the old Google Groups group is no longer active).

Install via npm: npm install ejs.

References:

6440 questions
1
vote
2 answers

Uncaught SyntaxError: Unexpected identifier on res.Render - NodeJS

I encounter an error on client side while sending a variable using res.Render(). I'd like to send an object with arrays in it: NodeJs: var countries_lat_lng = []; trip.countries.forEach(country => { var country_lat_lng =…
1
vote
3 answers

For loops in ejs

I have a array containing some html content like this. const articleArray=['

first text

\r\n','

second text>

\r\n','

third text

\r\n'] I need to render this in an ejs file through a get request request.render('viewArticles',{array :…
loksan
  • 157
  • 3
  • 17
1
vote
2 answers

How to do CSS customization in ejs-dropdownlist in Angular

this is my html tag and I want the placeholder to have font-size 15 and color grey. How to do it?
1
vote
1 answer

Site with node js and express / ejs does not always load images

I set up a website that basically uses Nodejs to fetch the image and after that sends it to ejs to display on the page, what happens is that sometimes the image appears and sometimes it looks like the website loads before the image can be loaded by…
Douglas S
  • 68
  • 8
1
vote
1 answer

Dynamically render ejs view from a list of views without having a single route for each of the views

I am building a node app with express. The views are in EJS. I have a list of EJS views. Instead of writing a different route for each of these views, is there a way to have only one dynamic route "/:dynamic_route" and then and then render the…
piraha
  • 65
  • 10
1
vote
0 answers

My search route in node redirects back to the same page, and that page cannot see my assets folder containing my css

My search route in node redirects back to the same page, and that page cannot see my assets folder containing my css. All other routes and pages have no issue. Setup of express app.set('views', path.join(__dirname, 'views')); app.set('assets',…
1
vote
4 answers

TypeError: Cannot read property 'items' of null in monogdb using nodejs

I am creating a todo list app , which adds items dynamically and creates list dynamically through url. For example : http://localhost:3000/Home will create a "Home" list and http://localhost:3000/Work will create "Work" with some default values…
Mohit Kumar Sharma
  • 611
  • 1
  • 10
  • 24
1
vote
0 answers

I cannot input object through post route, instead only get undefined in node js

i am trying to pass a comment and associate comment(object with name and author) to object of campground.but while i try to pass it through post route it will show undefined. error occur here //add a new comment in campground …
Ajahi himalil
  • 190
  • 2
  • 9
1
vote
0 answers

How to route inside .ejs file

Is there is any way to use route function inside the front-end, something like href="<%= route("add_agent") %> instead of using href="./add_agent" Add Agent Edit/Delete Agent
Omran Al_haddad
  • 117
  • 1
  • 7
1
vote
1 answer

How to handle the dynamic page on Node.js

I am using the Node.js(Express.js) and EJS. My query is how I can manage the Dynamic page. Here Dynamic means admin create the page, that page will be accessible and render according to the name of the category. Statically I can handle with create…
Ankit
  • 951
  • 1
  • 9
  • 29
1
vote
1 answer

How do I send multiple objects to .ejs file

I am trying to pass a query from MySQL to .ejs file, and send object at the same time. In the following code, I am trying to send rows and { pageTitle: "Edit Agents" } to edit_agents page Router.get("/", (req, res) => { …
Omran Al_haddad
  • 117
  • 1
  • 7
1
vote
0 answers

Open other tab from sub-navbar without loading entire new HTML page

I'm working on a page in a Node Web app with a subnav that looks like this: Here's the vanilla HTML for it:
1
vote
0 answers

IN My COMPARE WEATHER website page when a user click on the compare button only one city information is renderd in ejs tempelate?

'I had checked my code many times but i am not able to get my mistake.. And i know i had made my code a little clumsy and working to make my code more short rest every thing is working fine.. i had two get request one for the findweather…
1
vote
0 answers

Efficiently display details from array of 1000 elements in ejs page

I am doing a node app where I came across a scenario where If I have an array of 1000 elements and pass it from Node - Express (Backend) to ejs(Only HTMl and CSS Bootstrap) page which is a front end and loop through it , it takes lot of time to…
ashwanth s
  • 105
  • 1
  • 1
  • 10
1
vote
1 answer

Connecting to stylesheet that is several directiories above

I am making a Web Project using NodeJS and in which I'm linking to the stylesheet in the header file, which I've included in all of my EJS files The location of the header file is as follows root -> views -> partials -> header.ejs The location of…
Cyborg7459
  • 157
  • 3
  • 10
1 2 3
99
100