Controller path for nested route have duplicated directory name
When I use "angular-fullstack:route" or "angular-fullstack:controller" for pathname like "main/sub", created filename is like "main/sub/main/sub.js". It should be like "main/sub/sub.js".
$ yo angular-fullstack:route main/sub
? Where would you like to create this route? client/app/
? What will the url of your route be? /main/sub
create client/app/main/sub/main/sub.js
create client/app/main/sub/main/sub.controller.js
create client/app/main/sub/main/sub.controller.spec.js
create client/app/main/sub/main/sub.html
create client/app/main/sub/main/sub.scss
$ yo angular-fullstack:controller main/sub2 ? Where would you like to create this controller? client/app/ create client/app/main/sub2/main/sub2.controller.js create client/app/main/sub2/main/sub2.controller.spec.js
You're using the generator command in the incorrect folder.
Maybe you must use the command in the root directory of the project
You can use " pwd ", to know your current directory
Links: pwd command: http://unixhelp.ed.ac.uk/CGI/man-cgi?pwd
@equero I'm using "yo" command at the project root. The thing is, "yo angular-fullstack:route NAME" create file like client/app/NAME/NAME.js, regardless of whether NAME is pure basename or pathname containing "/". If NAME is "post", generated filename is "client/app/post/post.js". (It is OK.) If NAME is "main/post", generated filename is "client/app/main/post/main/post.js". (It is not OK. "client/app/main/post/post.js" should be generated.)
Doesn't it make sense ?
@yoshiokatsuneo what you should do instead is:
$ yo angular-fullstack:route post
? Where would you like to create this route? client/app/main/
? What will the url of your route be? /post
create client/app/main/post/post.js
create client/app/main/post/post.controller.js
create client/app/main/post/post.controller.spec.js
create client/app/main/post/post.html
create client/app/main/post/post.scss
@kingcody In that case, controller name is not "MainPostCtrl" but just "PostCtrl". So, when I created "main/create", "main/index", or "main/show" controllers, the controller names can easily conflicts with other controller in other directory(ex: "main2/index").
@yoshiokatsuneo I understand your use case now, thank you. I'm wondering if generating your routes like yo angular-fullstack:route mainCreate or yo angular-fullstack:route mainShow would be an acceptable solution.
@kingcody Yes, that's the way I do as a workaround, for now. :-) I am a bit afraid of scattering controllers(or filters or directives) on the same directory in the future, and thought nice if i can group some controllers.
Any thought on how such a grouping feature would work? What would be the logic for determining the path from a complex name such as main/index or main.index so that the path would be client/app/main/index/index.* and angular names would be MainIndex?
@kingcody How about just using controller basename as filename like "client/app/main/index/mainIndex.controller.js" ? Controller names can be "mainIndexCtrl"(as it is now for "main/index" routing).