문제

I know almost same kind of question is answered in couple of other posts but I'm getting "Unknown provider" error on calling service written in different file then callee Controller function. Could some one please help me to know what am I doing wrong? Here is my code

Controller.js

var mainApp = angular.module("mainApp", []);

mainApp.controller("PromoList", ['$scope', '$http', 'modelSerivce', function ($scope, $http, modelSerivce){
var serviceURL = modelSerivce.serviceURL();
console.log("from promolist controller: "+ serviceURL);}]);

Service.js

angular.module('mainApp').service('modelSerivce', function(){       
this.serviceURL = function()
{
    var serviceURL = “cofig.xml”;
    return serviceURL;
};});
도움이 되었습니까?

해결책

Did you reference Service.js in your .html file?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top