javascript - How to Call Method of ModelB.js from within ModelA.js? -
I am working with loopback 2.0.
I generated my model with generator and added a JS
How can I call a method from ModelA within ModelB? Example Folder structure: Car.js: Engines. Js: model property such as engine App to provide access to other models, for example:
/ General / Model Car.json Car.js Engine.json Engine.js. ..
module.exports = function (car) {Car.drive = function (destination) , Fn) {...} ...};
Module Exports = Function (Engines) {Engines} They have some = function (some, Fn) {// This is the place where I need Car.js var Loopback = (a 'loopback') to open a method Want to Var car = loopback Models.ccar; car. Druze ('49 .1234, 12.1234 ', FN); // ***} ...};
module.exports = function (engine) {Engine.doSomething = function (something, fn ) {// *** This is where I want to call a method from Car.js var car = Engine.app.models.Car; car. Druze ('49 .1234, 12.1234 ', FN); // ***} ...};
Comments
Post a Comment