Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

so when I do

yo angular:controller myController 

it creates

angular.module('MyTestModule')

Where is Yo looking to pick this up, anyway of updating it ??

Thanks

like image 729
Martin Avatar asked Jun 18 '13 11:06

Martin


2 Answers

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 file bower.json.

like image 104
draptik Avatar answered Nov 08 '22 00:11

draptik


There's an extra "l" in "controlller myController" in your description above, which will default to causing yeoman (or yo) to create an entire angular deployment, not just the controller alone. In any case its picking up part of that 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 notice the name of my controller module:

...
angular.module('yotestApp') 
...
like image 26
Matt Mullens Avatar answered Nov 08 '22 02:11

Matt Mullens