2

I have the following code:

app.factory(CService.Id,
    ["$rootScope", "$route", "$routeParams", "$location", "$timeout",
        ($rootScope, $route, $routeParams, $location, $timeout) =>
            new CService($rootScope, $route, $routeParams, $location, $timeout)]);

app.config(['$routeProvider', '$locationProvider',
    function ($routeProvider, $locationProvider) {
        $routeProvider.
            when('/', {
                templateUrl: 'page1.html',
                controller: 'page1Controller',
                controllerAs: 'ctl',
                reloadOnSearch: false
            }).
            when('/', {
                templateUrl: 'page2.html',
                controller: 'page2Controller',
                controllerAs: 'ctl',
                reloadOnSearch: false
            }).

in page1.html

<div>
 <input ng-model="ctl.field">
</div>

Now I want to pass value field from page1.html to page2.html, when click on a redirect button (this.location.path(/page2.html)) for example, how do I do that?

Thanks

georgeawg
  • 48,608
  • 13
  • 72
  • 95
blues
  • 167
  • 1
  • 7

0 Answers0