Docs

Authenticated routes (front-end)

If you open the angular/config/routes.config.js file, you notice that we're passing an empty data: {} parameter which every state inherits because it's set on the abstract route app.

Although this is an optional argument, we've implemented a custom logic in angular/run/routes.run.js that reads this value from inside this data object and sets authentication accordingly.

if you set

data: {
     auth: true
}

then those routes become protected. They would require authentication.

This behaviour can be enabled on a per route basis. Or per a group of routes, by creating abstract routes.

You can also extend this behaviour by setting a string value to auth, such as: auth: 'admin'. And then you would implement your own logic in routes.run.js.