Can you easily refactor the module name?


#1

Is there a way to refactor / change the name of a starter app’s module? When I create a new app using ionic start myapp tabs and then open up app.js, the angular module is still called starter like so:

angular.module('starter', ['ionic', 'starter.controllers', 'starter.services'])

This got me wondering, is there a way to have the ionic start command automatically set it to myapp instead? Perhaps a CLI command to refactor all the instances after ionic start has been run?

Thanks!


#2

ionic start creates a new cordova/ionic cli project… if you use any start template --> the sources are cloned from github and thats it.

change the name of the module an set the name in the index.html at the ng-app attribute.

Done


#3

Thanks @bengtler! Seems like it would be a useful CLI command to those who are prototyping often. Since there are several files to change (app, controllers, services, html) I thought Ionic might have a helper command to do it. I’ll use a sed command + bash alias to do this for me instead.

Thanks again, cheers!