generator-angular-xl icon indicating copy to clipboard operation
generator-angular-xl copied to clipboard

Controllers / states - improving folder structure

Open grabbou opened this issue 10 years ago • 1 comments

When creating state, e.g.

yo angular-xl:state users

I am getting folder users/index/index-controller.js which is correct. The problem is when I enter e.g.

yo angular-xl:state users/edit

That command creates users/edit/index/edit-controller.js and that has to be improved. The additional "index" folder here is useless and makes project a bit disorganized in my opinion.

I suggest: #1. The easiest way is to force users to use controller/action pattern, so to accomplish the first example, they should run

yo angular-xl:state users/index

(that command would create states/users/index/)

In the second example, the command would create simply states/users/edit/ which is a correct way to create multiple views. #2. If no action specified, assume it's 'index'. If action is specified (e.g. users/edit), skip appending index to the src.

I am able to create PR for that as currently I had to customize that in my project :)

grabbou avatar May 19 '14 08:05 grabbou

Sorry for getting back to you on this half a year after your issue was created!

I agree that this pattern might be a bit unclear, but if I understand you correctly it will cause the index states files to be in a top level folder, so that if one chose to create another state at users/edit/confirm it would mix index states files with subfolders for the other states? I think I prefer the way it currently works, but I might not have appreciated and understood your suggestion fully.

Thanks for your interest in contributing and letting me know about this issue!

kennethlynne avatar Sep 03 '14 20:09 kennethlynne