Friday, 17 March 2017

How Import a client utily js in my controllers.js

Suppose to be in a particular forlder and in this folder there are two files, one file called utile.js and another file called controllers.js. Now the file utile.js is composed in this way:

'use strict';
define('utile', [], function() {
    var modulo = {};


modulo.getLimiteCaratterePost = function() {
    var limite_carattari_post = 25;
    return limite_carattari_post;
    };
        return modulo;

    });

Now I need, in controllers.js, to use the method "getLimiteCaratterePost" in my controllers.js. Now I don't know how import it and I don't know if I can do this in node js. In my controllers I do to import the utile.js:

var utile=require(['utile']);

but it doesn't work. Anyone can help me?



via Picco

No comments:

Post a Comment