Simplest? Set values on $rootScope.
$rootScope.name = name;
Now just inject $rootScope in any controller that needs name.
angular.module('myModule').controller('CtrlA', function($rootScope) {
$rootScope.name = "something";
});
angular.module('myModule').controller('CtrlB', function($rootScope) {
console.log($rootScope.name);
});
If you start to add a lot of values to rootScope you're probably better off using a service.
The service equivalent for something simple like a name is this:
angular.module('myModule').service('Name', function Name() {
var name;
var service = {
getName: function() { return name; },
setName: function(n) { name = n; }
};
return service;
});
Then you can inject this service in different controllers.
angular.module('myModule').controller('CtrlC', function(Name) {
Name.setName('hello world!');
});
angular.module('myModule').controller('CtrlD', function(Name) {
$scope.name = Name.getName();
console.log($scope.name);
});