here is my
angularroute.html
<html xmlns="http://www.w3.org/1999/xhtml" ng-app="AngularApp">
<head>
<title></title>
<script src="angular.js"></script>
<script src="angular-route.js"></script>
<script type="text/javascript">
var AngApp = angular.module('AngularApp', ['ngRoute']);
AngApp.config(function ($routeProvider) {
$routeProvider
.when('/Route1/:ID', {
templateUrl:'Route1.html',
controller:'Route1'
})
.when('/Route2', {
templateUrl: 'Route2.html',
controller:'Route2'
})
.otherwise({
redirectTo: '/'
});
});
</script>
</head>
<body>
<p>Routing Explained</p>
<a href="#Route1/100">Route1</a><br>
<a href="#Route2">Route2</a>
<div ng-view>
</div>
<script src="Route.js"></script>
</body>
</html>
the Route.js file contains.
angular.module('Route1').controller('Route1', function ($scope, $routeParams) {
$scope.ID = $routeParams.ID;
});
angular.module('Route2').controller('Route2', function () {
});
Route1.html
<html xmlns="http://www.w3.org/1999/xhtml" ng-app="Route1">
<head>
<title></title>
</head>
<body ng-controller="Route1">
{{ID}}
{{4+10}}
</body>
</html>
the problem is it loads the page but i can not receive get the parameter value , on route1.html ,the expression also do not get evaluated .
what could be the problem?
thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…