can't make use of UnderscoreJS inside a Controller...

29 views
Skip to first unread message

Frederic Jacquemin

unread,
Dec 1, 2013, 12:35:10 PM12/1/13
to locomo...@googlegroups.com
Hi guys,


I might be completely tired, but for some reason I can't get underscoreJS correctly plugged in LocomotiveJS...


did an 'npm install underscore'
in All.js : added "require('underscore');" at the top to make it look like this:
var express = require('express')
, poweredBy = require('connect-powered-by')
, util = require('util')
, _ = require('underscore');


Then required it again in the controller (same way).


I tried several options :


var __ = require('underscore');
var _ = require('underscore')._;
var underscore = require('underscore');
etc, etc, etc.


it does work correctly right after this : var MyCtrl = new Controller();
this displays the correct answer : console.log(" Testing _ : " + _.indexOf([1,2,3,4],4) );

But not inside any Controller ... for sure I need to make it available somehow, but don't know how.

Waiting for a little help on this :)

Thanks,
Frederic
PS: might be useful for other libraries to require later on ...

Frederic Jacquemin

unread,
Dec 1, 2013, 12:57:05 PM12/1/13
to locomo...@googlegroups.com
Nevermind,

this works perfectly well...

My '_.where' call had bad parameters...

Sorry,
have a nice sunday :)

Frederic
Reply all
Reply to author
Forward
0 new messages