Dinesh Rawat Dinesh Rawat - 1 year ago 89
AngularJS Question

How to create more than one index pages in angular js?

I am new in Angular.js. I have a simple HTML page (angular layout). I want to ask:-

1: Is it possible to have more than one index pages for the project? If yes, then how?

2: Is it possible to make section dynamic, based on the state url?


Thank you all in advance!

Answer Source

Yes you can set partial views and independent controller in angular js. You can set that in your project config. This is a sample implementation.

(function () {
    'use strict';

    angular.module('YourApp', [

    .config(['$routeProvider', function ($routeProvider) {
        $routeProvider.when('/login', {
            templateUrl: 'login.html',
            controllerAs: 'loginCtrl',
            controller: 'loginController'
        $routeProvider.when('/dashboard', {
            templateUrl: 'dashboard.html',
            controllerAs: 'dashboardCtrl',
            controller: 'dashboardController'
            redirectTo: '/login'

Here the login.html and dashboard.html are your partial view file and loginController, dashboardController are your controller for respective views.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download