angularjs - $routProvider not working in angular js -
i trying include view page in angularjs working.
here code
rootservice.js
var viewcustomermodule = angular.module('viewcustomer',['ngroute','ngresource']); viewcustomermodule.config(function($routprovider){ $routeprovider .when('/customerlist',{ templateurl: 'resources/view/checker.jsp', controller: 'checkercontroller' }) })
viewcustomer.js
var viewcustomermodule = angular.module('viewcustomer',['ngroute','ngresource']); viewcustomermodule.controller('checkercontroller', function($scope) { $scope.headingtitle = "list items"; });
masterpage.jsp
<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html ng-app="viewcustomer"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>add company</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script> <script src="https://code.angularjs.org/1.4.8/angular-route.js"></script> <script src="https://code.angularjs.org/1.4.4/angular-resource.js"></script> <script src="<c:url value="/resources/js/viewcustomer.js"/>"></script> <script src="<c:url value="/resources/js/rootservice.js"/>"></script> </head> <body> <div > <a href="#/customerlist">viewcustomer</a> <div ng-view></div> </div> </body> </html>
checker.jsp
<h3 ng-controller="checkercontroller">{{headingtitle}}</h3>
above code used not working in browser console error
error: [$injector:modulerr] http://errors.angularjs.org/1.4.4/$injector/modulerr?p0=viewcustomer&p1=%5b%24injector%3aunpr%5d%20http%3a%2f%2ferrors.angularjs.org%2f1.4.4%2f%24injector%2funpr%3fp0
can 1 me fix this
please change $routprovider
$routeprovider
in rootservice.js
file. rootservice.js
this:
var viewcustomermodule = angular.module('viewcustomer',['ngroute','ngresource']); viewcustomermodule.config(function($routeprovider){ $routeprovider .when('/customerlist',{ templateurl: 'resources/view/checker.jsp', controller: 'checkercontroller' }) })
Comments
Post a Comment