Not able to call service in angularjs -


i getting following error:

error: [$injector:unpr] unknown provider: myserviceprovider <- myservice  

while calling service in angularjs please me solve issue

var app = angular.module('app', [])  app.controller('mycontroller', ['$scope', 'stringservice', function ($scope, stringservice) {     $scope.output = stringservice.processstring(input); }]);  var app = angular.module('app', []); app.factory('stringservice', function(){     return{         processstring: function(input){             if(!input){                 return input;             }              var output = "";             for(var = 0; < input.length; i++){                 if(i > 0 && input[i] == input[i].touppercase()){                     output = output + " ";                 }                 output = output + input[i];             }             return output;         }     } }); 

in:

['$scope', 'myservice', function ($scope,   stringservice) 

you injecting myservice doesn't exist. so, change to:

['$scope', 'stringservice', function ($scope,   stringservice) 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -