I've been trying to access the name and age using $scope and $rootScope, but I keep getting an error even though I'm pretty sure everything is set up correctly. Can someone please point out where I might be making a mistake?
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular-route.min.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<a href="#/one">One</a><a href="#/two">Two</a>
<ng-view></ng-view>
<script>
//app declaration
var app = angular.module("myApp",['ngRoute']);
//routing
app.config(['$routeProvider',function($routeProvider){
$routeProvider
.when('/one',{templateUrl:'one.html'})
.when('/two',{templateUrl:'two.html'})
.otherwise({templateUrl:'one.html'});
}]);
//config
app.run(['rootScope', function($rootScope){
$rootScope.age = 25;
}]);
//controller
app.controller('myCtrl',function($scope, $rootScope){
$scope.name = "Peter";
});
</script>
</body>
</html>
one.html
ONE => {{name}},{{age}}
two.html
TWO => {{name}},{{age}}
Updated Error: