angularjs - Error: $injector:unpr Unknown Provider -


i trying make share service using following code:

whoisapp.service('sharedscope',function($scope){      this.domainname="google.com"; });  whoisapp.controller('maincontroller',function($scope,sharedscope){      $scope.$watch('domainname',function(){         sharedscope.domainname=$scope.domainname;     }); }); 

the problem is, when run application, face error in console:

error: $injector:unpr  unknown provider 

it seems little strange since have defined sharedscopeservice. wrong code?

update:

here definition of app:

var whoisapp=angular.module('whoisapp',['ngroute','ngresource']);  whoisapp.config(function($routeprovider){     $routeprovider     .when("/",{         templateurl:'home.html',         controller: 'maincontroller'     }) }); 

there error in function parameters, should this:

whoisapp.controller('maincontroller',function($scope, sharedscope){.. 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -