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:

  / General / Model Car.json Car.js Engine.json Engine.js. ..    

Car.js:

  module.exports = function (car) {Car.drive = function (destination) , Fn) {...} ...};   

Engines. Js:

  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); // ***} ...};   

model property such as engine App to provide access to other models, for example:

  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

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -