I have a login page an then I have multiple other pages that follows the login page. I am using Express and chose ejs as my template engine and I created 2 ejs files: 1 for my login page and 1 for the rest of my pages.
My app.js app.get looks like follows:
app.get('/', function (req, res) {
res.render("login", { client_id: client_id, app_url: app_url});
});
app.get('*', function (req, res) {
res.render("index", { client_id: client_id, app_url: app_url});
});
My controller loads the login page and then loads the dashboard
function config($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise("/");
$stateProvider
.state('login', {
url: "/",
templateUrl: "views/login.html",
})
$stateProvider
.state('dashboard_1', {
url: "/dashboard",
templateUrl: "views/dashboard.html",
})
When i navigate to / the login.ejs must be loaded when I navigate to any other url my indes.ejs must be loaded. How do I get this to work?