I am following a tutorial on Angular Services and testing the below mentioned code. I am able to get the value in view from a TestService like -
TestService.name & TestService.$get()
but I want to know what if I need to get a value returned from the function like - return "From myFun"+this.name; in this case.
Code -
var myApp = angular.module('myApp', []);
myApp.controller('mainCtrl', function($scope, TestService){
    $scope.service = "Data From Service: "+TestService;
});
var myFun = function() {
    this.name = "FirstName";
    this.$get = function() {
        this.name = "Second Name";
        return "From $get: "+this.name;
    };
    return "From myFun"+this.name;
};
// A service returns an actual function
myApp.service('TestService', myFun);
 
     
     
    