Edit in JSFiddle

var APP = angular.module('APP', []);

APP.ApplicationCtrl = function ($scope, User) {
    
    User.setUsername('mrzepinski');
    
    $scope.getHelloMessage = function () {
        return User.sayHello();
    };
    
};
                                 
APP.service('User', function () {
    
    var _username = '';
    
    this.setUsername = function (username) {
        _username = username;
    };
        
    this.sayHello = function () {
        return 'Hello, ' + _username;
    };
    
});
<div ng-app="APP" ng-controller="APP.ApplicationCtrl">
    <h1>{{ getHelloMessage() }}</h1>
</div>