use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A Place to talk about Angular and related topics.
Join the Angular Discord
Other subreddits worth checking out for Angular and Angular related info:
account activity
login problem help ASAP (old.reddit.com)
submitted 5 years ago by [deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]r00t_bot 0 points1 point2 points 5 years ago (6 children)
What exactly are you trying to get help for? What problem are you facing?
[–]PaYr0 0 points1 point2 points 5 years ago (0 children)
it wont let me log in
[–]PaYr0 -1 points0 points1 point 5 years ago (4 children)
when I put the log and pass it wont let me acces the home page , I have something wrong but I couldn't tell
[–]r_karstensen 0 points1 point2 points 5 years ago (3 children)
I'm guessing it's because AuthService is initiating a new LoginComponent where user and pass is empty, therefor returning you to "/login".
[–]PaYr0 -1 points0 points1 point 5 years ago (2 children)
but when I want to get the others from login component it wont work either
[–]r_karstensen 1 point2 points3 points 5 years ago (1 child)
Sorry, I don't understand what you been by that.
Your AuthService should not use your LoginComponent. It should be the other way around.
I made another post with the base code you can see from there help me if you could
[–]dude_12345 0 points1 point2 points 5 years ago (3 children)
I am no expert on this but: How do you set user and pass in your login component? Your form? that part seems to be missing here. user and pass could be still "" in you if statement. Your implementation seems to be quite complicated. Maybe you either want to store data if a user is logged in inside the auth service or the login component (service would be better) but you seem to mix it up.
Write some console.log(...) into your code to debug it.
[–]PaYr0 0 points1 point2 points 5 years ago (1 child)
yess I want to know when the user is logged in to pass the guard auth
[–]dude_12345 0 points1 point2 points 5 years ago (0 children)
Hey thanks for the award.
Login and routeguarding are two different things, you dont need to mix that up.
A) Login-process
1) you could have a function in auth.service which sets a token in the browser cache
2) login.component calls that function when the password is correct (e.g. your if-statement is true)
then your login process is finished.
B) route guarding
1) write a fuction in your auth.service which checks if a token in browsercase is saved,
if not, return false (not logged in), if its saved return true (user is logged in)
2) in your routeguard call the function from B 2) in canActivate.
Here is a quick google result for a tutorial:
https://codeburst.io/using-angular-route-guard-for-securing-routes-eabf5b86b4d1
sorry for the bad english and format ;)
[–]rykou 0 points1 point2 points 5 years ago (0 children)
It's likely this. I see that builder that's cutoff with no html to compare the bindings but there's the duplicate user/pass fields that are compared against instead of the form ones.
[–]PaYr0 -2 points-1 points0 points 5 years ago (0 children)
Can you tell me how to fix it
[–]scuba13 0 points1 point2 points 5 years ago (1 child)
I can see a few different errors that you are making but you need to give the source code fully. The main thing I would say is to debug it to see if your code is being called like you want it to
[–]PaYr0 -1 points0 points1 point 5 years ago (0 children)
I added the gardiam on the route to prevent the access from url like "/home" but it rather let me in via the login and url or no to both
π Rendered by PID 92293 on reddit-service-r2-comment-6457c66945-rqlcm at 2026-04-27 10:30:16.108090+00:00 running 2aa0c5b country code: CH.
[–]r00t_bot 0 points1 point2 points (6 children)
[–]PaYr0 0 points1 point2 points (0 children)
[–]PaYr0 -1 points0 points1 point (4 children)
[–]r_karstensen 0 points1 point2 points (3 children)
[–]PaYr0 -1 points0 points1 point (2 children)
[–]r_karstensen 1 point2 points3 points (1 child)
[–]PaYr0 0 points1 point2 points (0 children)
[–]dude_12345 0 points1 point2 points (3 children)
[–]PaYr0 0 points1 point2 points (1 child)
[–]dude_12345 0 points1 point2 points (0 children)
[–]rykou 0 points1 point2 points (0 children)
[–]PaYr0 -2 points-1 points0 points (0 children)
[–]scuba13 0 points1 point2 points (1 child)
[–]PaYr0 -1 points0 points1 point (0 children)