AngularJS ngRoute - specify data for target page, with data not appearing in URLHow does data binding work in AngularJS?AngularJS passing data to $http.get requestAngularJS : Initialize service with asynchronous dataAngularJS: How to clear query parameters in the URL?Build query string from parameters objectangularjs not detecting the redirect urlAngularJS ui router passing data between states without URLAngularJS Spring MVC Redirection with data bindingangularjs ngroute not workingngRoute Params url on refresh Not working

Can an open source licence be revoked if it violates employer's IP?

How can religions without a hell discourage evil-doing?

Someone who is granted access to information but not expected to read it

Leveling up and Getting Items!

Does anyone recognize these rockets, and their location?

Can artificial satellite positions affect tides?

How would Japanese people react to someone refusing to say “itadakimasu” for religious reasons?

Threading data on TimeSeries

100-doors puzzle

How to search for Android apps without ads?

Should I email my professor to clear up a (possibly very irrelevant) awkward misunderstanding?

Converting 3x7 to a 1x7. Is it possible with only existing parts?

New Site Design!

How many times to repeat an event with known probability before it has occurred a number of times

I sent an angry e-mail to my interviewers about a conflict at my home institution. Could this affect my application?

Does WiFi affect the quality of images downloaded from the internet?

The title "Mord mit Aussicht" explained

Leveraging cash for buying car

Creating polygon with exact measurements in QGIS 3

The last tree in the Universe

Cremated People Pottery

How to know whether to write accidentals as sharps or flats?

Fastest path on a snakes and ladders board

How can I improve readability and length of a method with many if statements?



AngularJS ngRoute - specify data for target page, with data not appearing in URL


How does data binding work in AngularJS?AngularJS passing data to $http.get requestAngularJS : Initialize service with asynchronous dataAngularJS: How to clear query parameters in the URL?Build query string from parameters objectangularjs not detecting the redirect urlAngularJS ui router passing data between states without URLAngularJS Spring MVC Redirection with data bindingangularjs ngroute not workingngRoute Params url on refresh Not working






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm using AngularJS and I would like to redirect a user when he clicks a button on /page1 to /page2. I currently use AngularJS routing for this using ngRoute which works all fine. However, in addition to the redirection, I would also like to pass some data from page1 to page2 to pre-populate some of the HTML on page2. I know that in order to pass such data, I can either specify it in the path parameter,e.g.



/page2/<param1>/<param2>


or as a query string parameter, e.g.



 /page2?<key1>=<value1>&<key2=value2>


In both ways, I can retrieve the query string or path params in /page2 using $route.current.params



However, I do not want to do either of the above as I do not want to expose my data on the URL to the user. Is there a way in AngularJS that the parameters can be passed to /page2, such that they are "hidden" from the URL?



Thanks










share|improve this question
























  • You can use a service to store data that will survive route changes. Services are singletons that persist through the entire life of the app. For more information, see AngularJS Developer Guide - Creating Services.

    – georgeawg
    Mar 25 at 4:43











  • thanks, using a service worked! if you can add an answer I can accept it.

    – Shrikanth Rajgopalan
    Mar 25 at 6:28

















0















I'm using AngularJS and I would like to redirect a user when he clicks a button on /page1 to /page2. I currently use AngularJS routing for this using ngRoute which works all fine. However, in addition to the redirection, I would also like to pass some data from page1 to page2 to pre-populate some of the HTML on page2. I know that in order to pass such data, I can either specify it in the path parameter,e.g.



/page2/<param1>/<param2>


or as a query string parameter, e.g.



 /page2?<key1>=<value1>&<key2=value2>


In both ways, I can retrieve the query string or path params in /page2 using $route.current.params



However, I do not want to do either of the above as I do not want to expose my data on the URL to the user. Is there a way in AngularJS that the parameters can be passed to /page2, such that they are "hidden" from the URL?



Thanks










share|improve this question
























  • You can use a service to store data that will survive route changes. Services are singletons that persist through the entire life of the app. For more information, see AngularJS Developer Guide - Creating Services.

    – georgeawg
    Mar 25 at 4:43











  • thanks, using a service worked! if you can add an answer I can accept it.

    – Shrikanth Rajgopalan
    Mar 25 at 6:28













0












0








0








I'm using AngularJS and I would like to redirect a user when he clicks a button on /page1 to /page2. I currently use AngularJS routing for this using ngRoute which works all fine. However, in addition to the redirection, I would also like to pass some data from page1 to page2 to pre-populate some of the HTML on page2. I know that in order to pass such data, I can either specify it in the path parameter,e.g.



/page2/<param1>/<param2>


or as a query string parameter, e.g.



 /page2?<key1>=<value1>&<key2=value2>


In both ways, I can retrieve the query string or path params in /page2 using $route.current.params



However, I do not want to do either of the above as I do not want to expose my data on the URL to the user. Is there a way in AngularJS that the parameters can be passed to /page2, such that they are "hidden" from the URL?



Thanks










share|improve this question
















I'm using AngularJS and I would like to redirect a user when he clicks a button on /page1 to /page2. I currently use AngularJS routing for this using ngRoute which works all fine. However, in addition to the redirection, I would also like to pass some data from page1 to page2 to pre-populate some of the HTML on page2. I know that in order to pass such data, I can either specify it in the path parameter,e.g.



/page2/<param1>/<param2>


or as a query string parameter, e.g.



 /page2?<key1>=<value1>&<key2=value2>


In both ways, I can retrieve the query string or path params in /page2 using $route.current.params



However, I do not want to do either of the above as I do not want to expose my data on the URL to the user. Is there a way in AngularJS that the parameters can be passed to /page2, such that they are "hidden" from the URL?



Thanks







angularjs angularjs-ng-route






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 25 at 7:42







Shrikanth Rajgopalan

















asked Mar 25 at 2:54









Shrikanth RajgopalanShrikanth Rajgopalan

156314




156314












  • You can use a service to store data that will survive route changes. Services are singletons that persist through the entire life of the app. For more information, see AngularJS Developer Guide - Creating Services.

    – georgeawg
    Mar 25 at 4:43











  • thanks, using a service worked! if you can add an answer I can accept it.

    – Shrikanth Rajgopalan
    Mar 25 at 6:28

















  • You can use a service to store data that will survive route changes. Services are singletons that persist through the entire life of the app. For more information, see AngularJS Developer Guide - Creating Services.

    – georgeawg
    Mar 25 at 4:43











  • thanks, using a service worked! if you can add an answer I can accept it.

    – Shrikanth Rajgopalan
    Mar 25 at 6:28
















You can use a service to store data that will survive route changes. Services are singletons that persist through the entire life of the app. For more information, see AngularJS Developer Guide - Creating Services.

– georgeawg
Mar 25 at 4:43





You can use a service to store data that will survive route changes. Services are singletons that persist through the entire life of the app. For more information, see AngularJS Developer Guide - Creating Services.

– georgeawg
Mar 25 at 4:43













thanks, using a service worked! if you can add an answer I can accept it.

– Shrikanth Rajgopalan
Mar 25 at 6:28





thanks, using a service worked! if you can add an answer I can accept it.

– Shrikanth Rajgopalan
Mar 25 at 6:28












1 Answer
1






active

oldest

votes


















1














You can use a service to store data that will survive route changes. Services are singletons that persist through the entire life of the app.



app.service("appData", function() 
var myData;
this.set = function(data)
myData = data;
;
this.get = function()
return myData;
;



In a controller:



app.controller("viewCtrl", function($scope,appData) 
$scope.myData = appData.get();

//

appData.set(newData);

);


For more information, see AngularJS Developer Guide - Creating Services.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330692%2fangularjs-ngroute-specify-data-for-target-page-with-data-not-appearing-in-url%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    You can use a service to store data that will survive route changes. Services are singletons that persist through the entire life of the app.



    app.service("appData", function() 
    var myData;
    this.set = function(data)
    myData = data;
    ;
    this.get = function()
    return myData;
    ;



    In a controller:



    app.controller("viewCtrl", function($scope,appData) 
    $scope.myData = appData.get();

    //

    appData.set(newData);

    );


    For more information, see AngularJS Developer Guide - Creating Services.






    share|improve this answer



























      1














      You can use a service to store data that will survive route changes. Services are singletons that persist through the entire life of the app.



      app.service("appData", function() 
      var myData;
      this.set = function(data)
      myData = data;
      ;
      this.get = function()
      return myData;
      ;



      In a controller:



      app.controller("viewCtrl", function($scope,appData) 
      $scope.myData = appData.get();

      //

      appData.set(newData);

      );


      For more information, see AngularJS Developer Guide - Creating Services.






      share|improve this answer

























        1












        1








        1







        You can use a service to store data that will survive route changes. Services are singletons that persist through the entire life of the app.



        app.service("appData", function() 
        var myData;
        this.set = function(data)
        myData = data;
        ;
        this.get = function()
        return myData;
        ;



        In a controller:



        app.controller("viewCtrl", function($scope,appData) 
        $scope.myData = appData.get();

        //

        appData.set(newData);

        );


        For more information, see AngularJS Developer Guide - Creating Services.






        share|improve this answer













        You can use a service to store data that will survive route changes. Services are singletons that persist through the entire life of the app.



        app.service("appData", function() 
        var myData;
        this.set = function(data)
        myData = data;
        ;
        this.get = function()
        return myData;
        ;



        In a controller:



        app.controller("viewCtrl", function($scope,appData) 
        $scope.myData = appData.get();

        //

        appData.set(newData);

        );


        For more information, see AngularJS Developer Guide - Creating Services.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 25 at 7:30









        georgeawggeorgeawg

        37.1k115473




        37.1k115473





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330692%2fangularjs-ngroute-specify-data-for-target-page-with-data-not-appearing-in-url%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현