How to generate your classes in a specific folder with Angula2 CLI?
Generated items for the Angular CLI are relative...
if you are in the root dir (or the source dir) you are perceived to be in the app dir...
~/me/foo > ng g c bar
// ~/me/foo/src/app/bar/bar.component*
~/me/foo/src > ng g c bar
// ~/me/foo/src/app/bar/bar.component*
if you are in the app directory or further down the folder structure you will generate to where you are...
~/me/foo/src/app/feature > ng g c bar
// ~/me/foo/src/app/feature/bar/bar.component*
~/me/foo/src/app/feature > ng g c ../bar
// ~/me/foo/src/app/bar/bar.component*
Note: if you try to generate into a dir that does not exist, it will error...
~/me/foo/src/app > ng g c a/b/c/d/e/f/g/bar
// Error
To create a todo component inside the models folder in your project, just make sure you are in the project's root folder and type:
ng g c /models/todo
Also, if you want to specify a the declaring module's file name, you can use the -m option.
For example, if you have a models module, and want to update that module for declare your new todo's component:
ng g c /models/todo -m model
Regards
ng g cl model/UserInfo
works fine in angular5