Hello all i am trying to carry one of the field value from one html page to another using angular js. Below are the code snippets
HTML:
<body ng-app="myApp">
<div ng-controller="ExampleOneController">
Name:<input type = "text" ng-model="newVar.val">
</div>
<div ng-controller="ExampleTwoController">
<pre>value of name is {{anotherVar.val}}</pre>
</div>
AngularJS:
var myApp = angular.module("myApp", []);
myApp.controller("ExampleOneController", function($scope, NewsService) {
$scope.newVar = {
val: ""
};
NewsService.newVar = $scope.newVar;
$scope.news = NewsService.news;
});
myApp.controller("ExampleTwoController", function($scope, NewsService) {
$scope.anotherVar = NewsService.newVar;
$scope.news = NewsService.news;
});
It is working fine if i put the elements in same page but not if i put them in two different html pages
Where am i doing wrong.Please help me out
Thank You Mark.