Questions tagged [embedded-javascript]

Embedded JavaScript templates for node

Embedded Javascript is a template with JavaScript code embedded.

Anything inside the tag <%...%> is executed as JavaScript code, and anything inside the tag <%=...%> is replaced by the evaluated value.

Highlights :

HTML string concatenation without the messiness.

Easily load templates from separate files.

Rails-like view helpers.

Template caching and partials.

Intelligent error handling with line numbers.

References :

  1. Embedded JavaScript homepage

  2. Embedded JavaScript @GoogleCode

  3. Embedded JavaScript @GitHub

55 questions
1
vote
1 answer

Express framework: How to capture a value on clicking an image and use that value to fetch database details into another html page

I have the following ejs file and I want to capture the NAME field value inorder to fetch the respective details from database and display onto another page. I know how to do this using form tag, but I am unsure how to capture in this case. Any help…
Ann
  • 15
  • 7
1
vote
1 answer

Express parsing JSON into template through route

I have am having trouble parsing data from a mongodb through a route. I'd like to return the title fields for each object. I have the following schema: var mongoose = require('mongoose'); var Schema = mongoose.Schema; var GiveSchema = new…
byrdr
  • 5,197
  • 12
  • 48
  • 78
0
votes
1 answer

Add "all" option to select filter component in bootstrap-table in embedded javascript

I have a data-table where we're using Bootstrap 4 and bootstrap-table. I've added the bootstrap-table plugin Filter Control so that I may have some options for sorting. In a column for active users, I have a simple "yes" or "no" value. The data is…
0
votes
1 answer

How to transfer data to a template without using EJS?

app.get("/movies", function(req, res) { Movies.find({}, function (err, foundMovie){ if(err) { console.log(err); } else { res.render("movies/index", {movie_index:foundMovie}); } } }); I have this code that finds a movie…
Encrypted Drink
  • 91
  • 1
  • 11
0
votes
1 answer

Including embedded javascript functions from external file

I'm using embedded javascript and defined certain functions within to build up a table: <% function createCollectionTableRow(col) { %> <%=…
Omnia87
  • 103
  • 7
0
votes
1 answer

NODE.JS / EJS - ReferenceError: file.ejs can't recognize definition of variables

I have an issue with how my express.js server is templating. I'm getting an error that 'x is not defined' but I literally can't see anywhere that I'm messing something up. Cross checked some friends code who's working the same tutorial and on his…
0
votes
1 answer

Embedded JS (ejs) isn't rendering data to browser

I'm working on a simple To Do app using express, node, pg-promise, and ejs. I created a database and I can't get the contents to show up in the browser. The weird thing is that when I inspect the browser it recognizes the shape of each task, but…
Tsardines
  • 883
  • 2
  • 8
  • 17
0
votes
0 answers

EJS - How to display variables/variables not showing up

I'll just give the run-down. Server.js: // load the things we need var express = require('express'); var app = express(); // set the view engine to ejs app.set('view engine', 'ejs'); // use res.render to load up an ejs view file // index page…
user7593310
0
votes
1 answer

Google map from server side to post on ejs page

How can you show a Google map on an ejs page when you call it from server side, I can do it directly on the index page but need to figure out how to use the data I grabbed from server side to create the markers on the map. Tx
0
votes
1 answer

Node.js - Boolean (Checkbox) Field in Embedded Javascript

I've a boolean field in the model just similar to the below one. And I want to create a view using embedded javascript. **settings.js** module.exports = { attributes: { myField:{ type:'boolean', defaultsTo:'false' …
cloudnat
  • 71
  • 5
0
votes
1 answer

Parse Cloud Hosting Truncating User Results

I'm having a strange issue with Parse's Cloud Hosting platform. I have a route that displays info on all 'Providers' in my system. A Provider has a column that is a Pointer to a User object. This is a special Parse.User object. My goal is to get all…
Pop-A-Stash
  • 6,572
  • 5
  • 28
  • 54
0
votes
1 answer

I can't use EJS layout using res.render()

I've been trying to use express-ejs-layouts module. My when I try second route, browser finds my JS and CSS resource file under my second EJS files -that was written by me into second route function. What should I do? My Layout appears properly with…
efkan
  • 12,991
  • 6
  • 73
  • 106
0
votes
2 answers

Node.js - where to find incoming parameter in the HTML/document

I have the following function in my Node.js code that renders an HTML page and passes it an javascript object called htmlParamObj exports.getPage = function (req, res, next) { var htmlParamObj= { propertyOne: 'yada', …
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
0
votes
0 answers

Combine EJS templates to one file

I like to build a node site from a JSON file. The JSON file is read by Node js. In the JSON are templates names. I like to combine json multi templates to on file. I tried this code but this it isn't working app.set('views', __dirname +…
Wouter
  • 427
  • 1
  • 4
  • 15
0
votes
1 answer

Nodejs send function to ejs

in app.js : app.locals.count = function(id, call) { var myId = mongoose.Types.ObjectId(id) db.collection('comment').aggregate({$match: {postid: myId}}, {$group : {_id: '$postid', nb: {$sum: 1}}}, function(err, cb){ for (i = 0; i < cb.length;…
PixelPixel
  • 39
  • 5