strongloop - Loopback: How to change the name of a model? -


i have model name "aaa_bbb", want change name aaa-bbb, know how can achieve that? or can change name directly in model json file? here current model.json file.

{   "name": "aaa_bbb",   "base": "persistedmodel",   "idinjection": true,   "options": {     "validateupsert": true   },   "properties": {     ...   },   "acls": [],   "methods": [] } 

typically there 3 steps:

1 - change model name in server/model-config.js

{   ...   "aaa_bbb": { // change "aaa-bbb"     "datasource": "db",     "public": true   } } 

2 - change model name in common/models/aaa-bbb.json:

{   "name": "aaa_bbb", // change "aaa-bbb"   "base": "persistedmodel",   ... } 

3 - change model name in `commmon/models/aaa-bbb.js:

module.exports = function(aaabbb) { // change this...  }; 

...however, in case aaabbb doesn't change, not need perform step 3. loopback automatically removes _ or - model name , uppercamelcases model name during scaffolding. means both aaa_bbb , aaa-bbb output aaabbb.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -