My app.js contains
var app = angular.module(\'myApp\', []).
config([\'$routeProvider\', function ($routeProvider, $http) {
...
}]);
Servic
You need to return addNums in app.service callback.
app.service('MyService', function () {
addNums = function (text) {
return text + "123";
}
return addNums;
});
Now, whenever you use MyService, angular will give you back the addNums function to use.
Therefore, you should use it in your controller like so (note there isn't the addNums call):
function adminCtrl ($scope, MyService) {
$scope.txt = MyService("abc");
};