Yeoman / Yo: Where does Yo scaffolding write the name of the Angular module?

I created my Angular application using the specific module name, and now I decided to change it.

so when i do

yo angular:controller myController 

he creates

 angular.module('MyTestModule') 

Where does Yo want to choose it, somehow update it?

thanks

+7
source share
4 answers

Thanks for the help. After a little research, it turned out that the name was taken from component.json, editing this file means that a new name will appear in the properties of the objects

thanks

-5
source

In the current version (Yeoman 1.0.4, generator-angular 0.4.0), the name seems to be taken from the "name" property in the bower.json file.

+17
source

In the above description, an extra “l” is added to the “controlller myController”, which by default will cause yoman (or yo) to create the whole angular deployment, not just the controller. In any case, its collecting parts of this name from the directory of your deployment. So, for an example, I did this:

 mkdir yotest cd yotest npm install -g yo grunt-cli bower generator-angular yo angular:controller myController vi app/scripts/controllers/myController.js 

And pay attention to the name of my controller module:

 ... angular.module('yotestApp') ... 
+1
source

According to my experience (I do not use bower, and then systematically delete all files about it), Yo selects the name of the main module from the main folder.

And about the 'App' suffix, according to this commit https://github.com/yeoman/generator-angular/commit/09f0f7b3a8c3264b7527bc9fed8c709becec99eb , you can change it with --app-suffix="foobar" when you run the yo angular command:

 yo angular foobar --app-suffix="" yo angular:controller myCtrl --app-suffix="" 

will create:

  • Module named foobar
  • Controller: foobar.myCtrl

But I do not know how to save this parameter as default behavior. I do not think that's possible.

0
source

All Articles