angular routing - Angularjs : [$injector:modulerr] error -
i dont understand error . when load root url shows uncaught error: [$injector:modulerr]
, , "/ssh" not working . using 1.3. here code :
<!doctype html> <html ng-app="hiren"> <head lang="en"> <meta charset="utf-8"> <base href="/" /> </head> <body> <div class="col-sm-1" ng-view> </div> </div> <script src="lib/angular/angular.min.js"></script> <script src="lib/angular-route/angular-route.min.js"></script> <script src="src/hiren.js"></script> </body> </html>
hiren.js:
angular.module('hiren', ['ngroute']). config( function($routeprovider, $locationprovider){ $routeprovider .when('/ssh', { templateurl: 'views/ssh.html', controller: 'ssh' }); $locationprovider.html5mode(true); }). controller('ssh', function($scope){ $scope.xox = "example"; });
you have wrap angular code in script tag , set within html tag
<script> angular.module('hiren', ['ngroute']). config( function($routeprovider, $locationprovider){ $routeprovider .when('/ssh', { templateurl: 'views/ssh.html', controller: 'ssh' }); $locationprovider.html5mode(true); }). controller('ssh', function($scope){ $scope.xox = "example"; }); <script>
angularjs angular-routing
No comments:
Post a Comment