angularjs - getting dependency injection error while trying to add dependency with ngRoute -


i have created app in angularjs in adding dependency ngroute routing , created 1 service making rest call . when trying inject dependency ngroute getting below error .

angular.min.js:6 uncaught error: [$injector:modulerr]     http://errors.angularjs.org/1.4.8/$injector/modulerr?p0=logindo&p1=error%3a…tp%3a%2f%2flocalhost%3a8081%2fwebservices%2fjs%2fangular.min.js%3a19%3a463) 

loginservice.js

var loginservice=angular.module('loginservice',['ngresource']);  loginservice.factory('loginfactory',['$resource',function($resource){      return $resource('http://localhost:8081/webservices/rest/authentication?  username=:username'+'&password=:password'); }]); 

loginctrl.js

var logintest=angular.module('logindo',['ngroute','loginservice']);  logintest.config(['$routeprovider', function($routeprovider){  $routeprovider     .when('/register' , {          templateurl:'registration_ang.html',         controller: 'loginctrl'     })     .when('/login' , {          templateurl:'login.html',         controller: 'loginctrl'     })      .otherwise({         redirectto : '/login'     })     ;  }]);   logintest.controller('loginctrl',['$scope',function($scope){  $scope.login=function(){      console.log("inside loginctrl : login function");     var username=$scope.username;     var password=$scope.password;            /*loginfactory.query({'username':username,'password':password},function(data){         console.log('result:'+data);         alert('result:'+data);     })*/  }; }  ] ); 

login.html

<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>registration_ang.html</title>      <script type="text/javascript" src= "/webservices/js/angular.min.js"></script>     <script type="text/javascript" src= "/webservices/js/angular-resource.min.js"></script>     <script type="text/javascript" src= "/webservices/js/angular-route.min.js"></script>     <script type="text/javascript" src= "/webservices/js/friendsctrl.js"></script>     <script type="text/javascript" src= "/webservices/js/friendsservice.js"></script>     <script type="text/javascript" src= "/webservices/js/loginctrl.js"></script>     <link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css">    </head> <body >  <div ng-app="logindo">        <div class="col-md-4 ">     <h2>login</h2>     <form name="form"  role="form" ng-submit="login()">          <div class="form-group"  >             <label for="username">username</label>             <input type="text" name="username" id="username" class="form-control" ng-model="username" required />             <span ng-show="form.username.$dirty && form.username.$error.required" class="help-block">username required</span>         </div>         <div class="form-group" >             <label for="password">password</label>             <input type="password" name="password" id="password" class="form-control" ng-model="password" required />             <span ng-show="form.password.$dirty && form.password.$error.required" class="help-block">password required</span>         </div>          <div class="form-actions">             <button type="submit"  class="btn btn-primary">login</button>         </div>         </form> </div>  </div>       </body> </html> 

can please me doing wrong here .

thanks

you forgot include loginservice.js file. should be:

<script src="friendsctrl.js"></script> <script src="friendsservice.js"></script> <script src="loginctrl.js"></script> <script src="loginservice.js"></script> 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -