Angular, Automate user page creation


currently I’m building a web app. I have been following a guide that incorporates data to localstorage. Currently I can register. However now I want to be able to create a public html page for that person at the same time. the user instance contains things like email and username etc.

function register() {
            const user = body

            if (users.find(x => x.username === user.username)) {
                return error('Username "' + user.username + '" is already taken')

   = users.length ? Math.max( => + 1 : 1;
            localStorage.setItem('users', JSON.stringify(users)); //////

            return ok();

where I’ve added the //////. Is there any way to grab this data and automatically create a html page with the newly registered data? I’ve created links to these pages but I’m hoping there is a method to add a new page, like a personal home page.

The html pages should be named users/${id}.

Thanks, any help is appreciated.


If I understood correctly, you want to navigate the user to the dashboard creating the account.

For this, you will need to create a component that will act as a page, and define a route to it that can accept the ID as a parameter, something like:

{ path: 'users/:id', component: DashboardComponent }

So after the user create his account, you can navigate him to users/ID which will show the DashboardComponent that will use this ID to get his unique properties and display it to the user.

router.navigate(['/users', id]); or [routerLink]="['/users',]"

You can find all the info you need for the routing here:

Another good tutorial for route params here:

Answered By – yazantahhan

Answer Checked By – Jay B. (AngularFixing Admin)

Leave a Reply

Your email address will not be published.