AngularJS service in separate file
问题 My app.js contains var app = angular.module('myApp', []). config(['$routeProvider', function ($routeProvider, $http) { ... }]); Service looks like app.service('MyService', function () { addNums = function (text) { return text + "123"; } }); And in contoller I have function adminCtrl ($scope, MyService) { $scope.txt = MyService.addNums("abc"); }; They are all in separate files. The problem is that I'm getting an error Unknown provider: MyServiceProvider <- MyService Looks like I'm doing