I am using ng-constant . It creates a .js file that contains some angular constants of your choice.
grunt.initConfig({ ... ngconstant: { options: { name: 'config', dest: '<%= yeoman.app %>/scripts/config.js' }, development: { constants: { myVariable: 'it is development' } }, production: { constants: { myVariable: 'it is production' } } } });
And then just add it to your tasks:
grunt.registerTask('serve', [ ... 'ngconstant:development', ... ]);
And don't forget to include this /scripts/config.js file in your html and add "config" to your application.
var app = angular.module('myApp', [ 'config', ... ]);
source share