How to use login() to navigate to HomePage using nebular auth/login library?Ionic2 navController properties not working as expectedHow to prevent navigation to login and registration url after login in angular 2?menuToggle button hides when logging in from loginPageHow to update parent nav bar after login successfully in child component in Angular4?I am able to access data on my tabs page but not on my homepage in my appIonic 3 NavController refuses to navigate after logout and root page changeAngular 5 - Unable to navigate from one component to another componentLoad entity after login, and navigate to entityIDAngular 7 How to pass the object from login page to home pageIonic 4 Angular router navigate and clear stack/history of previous page

How do email clients "send later" without storing a password?

How to save PDFs from web for offline reading on an iPad?

Can a magnet rip protons from a nucleus?

Are scroll bars dead in 2019?

I asked for a graduate student position from a professor. He replied "welcome". What does that mean?

Is English tonal for some words, like "permit"?

How does Vivi differ from other Black Mages?

How can I maximize the impact of my charitable donations?

How to help my 2.5-year-old daughter take her medicine when she refuses to?

How could a imperial dynasty keep a loose collection of pirates, raiders, etc unified?

Are the definite and indefinite integrals actually two different things? Where is the flaw in my understanding?

Who are the two thieves that appear the opening of Batman: TAS?

Why was "leaping into the river" a valid trial outcome to prove one's innocence?

How to work with a technician hired with a grant who argues everything

Job offer without any details but asking me to withdraw other applications - is it normal?

Is the union of a chain of elementary embeddings elementary?

How can I protect myself in case of a human attack like the murders of the hikers Jespersen and Ueland in Morocco?

Is it possible to PIVOT on a LIKE statement

A medieval fantasy adventurer lights a torch in a 100% pure oxygen room. What happens?

How to stabilise the bicycle seatpost and saddle when it is all the way up?

Why did it become so much more expensive to start a university?

What does "synoptic" mean in avionics?

Writing a worded mathematical expression

If you have multiple situational racial save bonuses and are in a situation where they all apply do they stack?



How to use login() to navigate to HomePage using nebular auth/login library?


Ionic2 navController properties not working as expectedHow to prevent navigation to login and registration url after login in angular 2?menuToggle button hides when logging in from loginPageHow to update parent nav bar after login successfully in child component in Angular4?I am able to access data on my tabs page but not on my homepage in my appIonic 3 NavController refuses to navigate after logout and root page changeAngular 5 - Unable to navigate from one component to another componentLoad entity after login, and navigate to entityIDAngular 7 How to pass the object from login page to home pageIonic 4 Angular router navigate and clear stack/history of previous page






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I newly created the Angular Project with the nebular library installed. I want to create 3 pages.(Login, Register, and Home). I have already created login and register page with the help of built-in NbLoginComponent and NbRegisterComponent respectively. Now I want to navigate to HomePage once I click on login button of NbLoginComponent. (Basically I want to use this login() to navigate to HomePage) after the user successfully logs in. So where do I need to achieve such functionality?



Right now I am not able to do anything like that it stays in the same page with the NbLoginComponent. 



Simillarly, for NbRegisterComponent,
If I use , Once the user does successful registration, I want to navigate to login page ---> after successful login --> Home page.



So where do I need to achieve such functionality with nebular library?



I have already got the nebular/auth related pages like login, register, logout etc. (with latest Angular 7 and latest nebular library).



NbLoginComponent and NbRegisterComponent Code only



Expected : By using login() from NbLoginComponent need to navigate to Home Page after the successful login.And By using register() from NbRegisterComponent need to navigate to loginPage after the successfull registration.



Actual : In both of above situations, it stays in the same Page(means once you click on login button after successful login it stays in same login page, simillarly for register.).










share|improve this question
























  • Here is the new documentation on redirects github.com/akveo/nebular/blob/… If it still keeps you on the same page - it might indicate that the login wasn't successful and there is an error.

    – Dmitry Nehaychik
    Jul 10 at 16:27

















0















I newly created the Angular Project with the nebular library installed. I want to create 3 pages.(Login, Register, and Home). I have already created login and register page with the help of built-in NbLoginComponent and NbRegisterComponent respectively. Now I want to navigate to HomePage once I click on login button of NbLoginComponent. (Basically I want to use this login() to navigate to HomePage) after the user successfully logs in. So where do I need to achieve such functionality?



Right now I am not able to do anything like that it stays in the same page with the NbLoginComponent. 



Simillarly, for NbRegisterComponent,
If I use , Once the user does successful registration, I want to navigate to login page ---> after successful login --> Home page.



So where do I need to achieve such functionality with nebular library?



I have already got the nebular/auth related pages like login, register, logout etc. (with latest Angular 7 and latest nebular library).



NbLoginComponent and NbRegisterComponent Code only



Expected : By using login() from NbLoginComponent need to navigate to Home Page after the successful login.And By using register() from NbRegisterComponent need to navigate to loginPage after the successfull registration.



Actual : In both of above situations, it stays in the same Page(means once you click on login button after successful login it stays in same login page, simillarly for register.).










share|improve this question
























  • Here is the new documentation on redirects github.com/akveo/nebular/blob/… If it still keeps you on the same page - it might indicate that the login wasn't successful and there is an error.

    – Dmitry Nehaychik
    Jul 10 at 16:27













0












0








0


0






I newly created the Angular Project with the nebular library installed. I want to create 3 pages.(Login, Register, and Home). I have already created login and register page with the help of built-in NbLoginComponent and NbRegisterComponent respectively. Now I want to navigate to HomePage once I click on login button of NbLoginComponent. (Basically I want to use this login() to navigate to HomePage) after the user successfully logs in. So where do I need to achieve such functionality?



Right now I am not able to do anything like that it stays in the same page with the NbLoginComponent. 



Simillarly, for NbRegisterComponent,
If I use , Once the user does successful registration, I want to navigate to login page ---> after successful login --> Home page.



So where do I need to achieve such functionality with nebular library?



I have already got the nebular/auth related pages like login, register, logout etc. (with latest Angular 7 and latest nebular library).



NbLoginComponent and NbRegisterComponent Code only



Expected : By using login() from NbLoginComponent need to navigate to Home Page after the successful login.And By using register() from NbRegisterComponent need to navigate to loginPage after the successfull registration.



Actual : In both of above situations, it stays in the same Page(means once you click on login button after successful login it stays in same login page, simillarly for register.).










share|improve this question














I newly created the Angular Project with the nebular library installed. I want to create 3 pages.(Login, Register, and Home). I have already created login and register page with the help of built-in NbLoginComponent and NbRegisterComponent respectively. Now I want to navigate to HomePage once I click on login button of NbLoginComponent. (Basically I want to use this login() to navigate to HomePage) after the user successfully logs in. So where do I need to achieve such functionality?



Right now I am not able to do anything like that it stays in the same page with the NbLoginComponent. 



Simillarly, for NbRegisterComponent,
If I use , Once the user does successful registration, I want to navigate to login page ---> after successful login --> Home page.



So where do I need to achieve such functionality with nebular library?



I have already got the nebular/auth related pages like login, register, logout etc. (with latest Angular 7 and latest nebular library).



NbLoginComponent and NbRegisterComponent Code only



Expected : By using login() from NbLoginComponent need to navigate to Home Page after the successful login.And By using register() from NbRegisterComponent need to navigate to loginPage after the successfull registration.



Actual : In both of above situations, it stays in the same Page(means once you click on login button after successful login it stays in same login page, simillarly for register.).







angular nebular






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 9:01









Chaitra DeshpandeChaitra Deshpande

551 silver badge8 bronze badges




551 silver badge8 bronze badges















  • Here is the new documentation on redirects github.com/akveo/nebular/blob/… If it still keeps you on the same page - it might indicate that the login wasn't successful and there is an error.

    – Dmitry Nehaychik
    Jul 10 at 16:27

















  • Here is the new documentation on redirects github.com/akveo/nebular/blob/… If it still keeps you on the same page - it might indicate that the login wasn't successful and there is an error.

    – Dmitry Nehaychik
    Jul 10 at 16:27
















Here is the new documentation on redirects github.com/akveo/nebular/blob/… If it still keeps you on the same page - it might indicate that the login wasn't successful and there is an error.

– Dmitry Nehaychik
Jul 10 at 16:27





Here is the new documentation on redirects github.com/akveo/nebular/blob/… If it still keeps you on the same page - it might indicate that the login wasn't successful and there is an error.

– Dmitry Nehaychik
Jul 10 at 16:27












1 Answer
1






active

oldest

votes


















1
















If you are using NbLoginComponent.js as it is and designed your page in the decorate function then I suggest you to add following code in the login() method as follows--



NbLoginComponent.prototype.login = function () 
var _this = this;
this.errors = [];
this.messages = [];
this.submitted = true;

this.service.authenticate(this.strategy, this.user).subscribe(function (result)
_this.submitted = false;
if (result.isSuccess())
_this.messages = result.getMessages();
_this.router.navigateByUrl("/homepageurl");

else
_this.errors = result.getErrors();

_this.cd.detectChanges();
);
;


You will be redirected to the homepage.
Similarly you can add




_this.router.navigateByUrl("/login");




in RegisterComponent to redirect to the login page.






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/4.0/"u003ecc by-sa 4.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%2f55393617%2fhow-to-use-login-to-navigate-to-homepage-using-nebular-auth-login-library%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
















    If you are using NbLoginComponent.js as it is and designed your page in the decorate function then I suggest you to add following code in the login() method as follows--



    NbLoginComponent.prototype.login = function () 
    var _this = this;
    this.errors = [];
    this.messages = [];
    this.submitted = true;

    this.service.authenticate(this.strategy, this.user).subscribe(function (result)
    _this.submitted = false;
    if (result.isSuccess())
    _this.messages = result.getMessages();
    _this.router.navigateByUrl("/homepageurl");

    else
    _this.errors = result.getErrors();

    _this.cd.detectChanges();
    );
    ;


    You will be redirected to the homepage.
    Similarly you can add




    _this.router.navigateByUrl("/login");




    in RegisterComponent to redirect to the login page.






    share|improve this answer





























      1
















      If you are using NbLoginComponent.js as it is and designed your page in the decorate function then I suggest you to add following code in the login() method as follows--



      NbLoginComponent.prototype.login = function () 
      var _this = this;
      this.errors = [];
      this.messages = [];
      this.submitted = true;

      this.service.authenticate(this.strategy, this.user).subscribe(function (result)
      _this.submitted = false;
      if (result.isSuccess())
      _this.messages = result.getMessages();
      _this.router.navigateByUrl("/homepageurl");

      else
      _this.errors = result.getErrors();

      _this.cd.detectChanges();
      );
      ;


      You will be redirected to the homepage.
      Similarly you can add




      _this.router.navigateByUrl("/login");




      in RegisterComponent to redirect to the login page.






      share|improve this answer



























        1














        1










        1









        If you are using NbLoginComponent.js as it is and designed your page in the decorate function then I suggest you to add following code in the login() method as follows--



        NbLoginComponent.prototype.login = function () 
        var _this = this;
        this.errors = [];
        this.messages = [];
        this.submitted = true;

        this.service.authenticate(this.strategy, this.user).subscribe(function (result)
        _this.submitted = false;
        if (result.isSuccess())
        _this.messages = result.getMessages();
        _this.router.navigateByUrl("/homepageurl");

        else
        _this.errors = result.getErrors();

        _this.cd.detectChanges();
        );
        ;


        You will be redirected to the homepage.
        Similarly you can add




        _this.router.navigateByUrl("/login");




        in RegisterComponent to redirect to the login page.






        share|improve this answer













        If you are using NbLoginComponent.js as it is and designed your page in the decorate function then I suggest you to add following code in the login() method as follows--



        NbLoginComponent.prototype.login = function () 
        var _this = this;
        this.errors = [];
        this.messages = [];
        this.submitted = true;

        this.service.authenticate(this.strategy, this.user).subscribe(function (result)
        _this.submitted = false;
        if (result.isSuccess())
        _this.messages = result.getMessages();
        _this.router.navigateByUrl("/homepageurl");

        else
        _this.errors = result.getErrors();

        _this.cd.detectChanges();
        );
        ;


        You will be redirected to the homepage.
        Similarly you can add




        _this.router.navigateByUrl("/login");




        in RegisterComponent to redirect to the login page.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 17 at 13:40









        LeonemLeonem

        112 bronze badges




        112 bronze badges





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.




















            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%2f55393617%2fhow-to-use-login-to-navigate-to-homepage-using-nebular-auth-login-library%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

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript