NodeJS+SequelizeJS+Express+Jade, does model have many-to-many association in template

I have 2 models, a Product and a Shipping model, the shipping model stores means of shipping and each product can have more mean of shipping. In my express application in a route i manage to find a product and include the Shipping model, and pass the response of the success promise to a view file, together with all other means of shippings, in my view file i'd like to display all of the shippings and put a tick next to which the product has, I just cant figure it out how i could manage it, I know that hasShipping method of the product returns a promise, which accepts callbacks, but in jade its not the way things work, so im pretty much lost. I could iterate through the shippings key of the product in the route right before rendering the view, but that would really mess up my code, with 10s of rows of un-needed codes, in PHP its pretty easy to solve my problem, but in NodeJS I'm lost. Anyone?

Category:express Views:0 Time:2014-07-06

Related post

  • express jade upgrade to latest throwing error 2012-03-01

    My app was running fine with express, jade etc. Today when I upgraded this to latest express and jade, using npm update express jade, it started throwing the following error when i try to access the site. Is it expecting a package.json ? I am not usi

  • NodeJS MongoDB Express 4 getJSON Subarray Key Being Turned Into A String 2015-01-19

    This question already has an answer here: Jquery Ajax Posting json to webservice 4 answers Problem: When sending data to MongoDB via AJAX, the subarry name points[0][x] is becoming a single string: "points[0][x]". How do I prevent the key from becomi

  • Iterate over model instance field names and values in template 2010-01-31

    I'm trying to create a basic template to display the selected instance's field values, along with their names. Think of it as just a standard output of the values of that instance in table format, with the field name (verbose_name specifically if spe

  • Retrieving all the content of a MySQL query to Jade template engine through NodeJS and Express 2011-08-02

    Simple newbie question, I am starting out with nodejs, and I am pretty new to backend languages in general. I managed to publish a single field from a database to a webpage using the default jade engine in express-js. /** * Module dependencies. */ va

  • How Can I Assign an Expression To a Model Property Then Use It In a Partial For an ActionLInk? 2009-12-09

    Is it possible to assign an Lambda Expression (action?) to a property of my View Model, then use that expression in a Partial? What should the model's property type be? Psuedo Code: View Model public class MyModel { public ????? MyAction {get;set;} }

  • Node.js - express - jade - compile SASS/LESS 2010-12-03

    Anyone have a really newbie guide to nodejs - express - SASS/LESS? I have not been able to get this working. The example I have now is a bareboned as possible.. var express = require('express'), less = require('less'), app = express.createServer(); v

  • Using Mysql with Nodejs and Express (node-mysql) 2011-05-04

    Im new to node and express and I have a question regarding using mysql. I have a login form that posts to '/login'. Im using the node-mysql module. app.get('/site', function(req, res){ if (req.session.is_logged_in === true) { res.render('site/start',

  • MVC3 razor based htmlhelper with lambda field expressions based on model 2011-06-05

    Hello, I am creating a fluent HtmlHelper in MVC - to create a grid based on HTML. I am aware of mvc contrib and WebGrid - but I am making my own and have a specific problem: I have to enter this: @Html.DSGridFor().AddColumn(x=>x.FirstOrDefault().M

  • Express & Jade, templates adding code to the layout 2011-09-29

    I'm playing around with an Express site with Node.JS I have a layout file which, let's say, looks like this: html title foo body!= body From what I have been able to understand, the output of the template is inserted into a variable called body and t

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.114 (s). 11 q(s)