javascript - How to make Loopback models events work? -


i have tried example http://apidocs.strongloop.com/loopback/#model:

mymodel.on('changed', function(inst) {   console.log('model id %s has been changed', inst.id);   // => model id 1 has been changed }); 

i replaced mymodel actual model name. when save new instance or update existing one, expect see console log, nothing happens.

how make work it's described in docs?

as using loopback 3.0, not 2.0, mentioned listener deprecated , when changed example below, helped , works fine.

mymodel.observe('after save', (inst) => {     console.log('model id %s has been changed', inst.id); }); 

here more information:


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -