I have search a lot for finding problem in my code but didn't get solution. I'm trying routing in html file there are two links 1 for view1 and second for view2 code for both views are in different files in folder named parts and in js file i have created a module named mymodule my problem is when i remove "mymodule" from an-app in html file then {{ studname }} works fine but after adding "mymodule" i'm getting error
html file code :
<!DOCTYPE html>
<html ng-app="mymodule">
<head>
<title>Try Deep linking</title>
<script src="angular.min.js"></script>
<script type="text/javascript" src="route.min.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</head>
<body>
<input type="text" name="" ng-model="studname" />
<p>{{ studname }}</p>
<div ng-view>
</div>
<a href="#/view1">View 1</a>
<a href="#/view2">View 2</a>
</body>
</html>
JS code :
var myapp = angular.module("mymodule",[]);
myapp.controller( "mycontroller", function ($scope) {
$scope.student = [
{name : "Abhay Sehgal", city: "Delhi" },
{name : "Pankaj Singh", city: "Bihar" },
{name : "ujjwal", city : "UP"}
];
});
myapp.config(function($routeProvider){
$routeProvider
.when('/view1',{
controller : "mycontroller",
templateUrl : "parts/view1.html"
})
.when('/view2',{
controller : "mycontroller",
templateUrl : "parts/view2.html"
})
.otherwise({redirectTo :'/'});
});
Thanks in advance