Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS application multiple pages

I have an angularjs SPA application with an index.html page as the main template and the rest of the views are loaded as subviews in an ng-view tag. I'm using a twitter bootstrap template for the site so the template has a login page thats different from the rest of the pages. Is there a way to have multiple main template pages, one for the login page and one for everything else? I've been trying to figure out how to specify a different page in the route provider but I haven't been able to figure out how to specify a page rather than a partial view as the templateURL or if thats even possible.

I'm new to angularjs so i'm not sure what the best way to handle this situation.

Thanks

like image 533
MBU Avatar asked Oct 20 '22 22:10

MBU


1 Answers

You are on the right track with RouteProvider

angular.module('mymodule', ['ngRoute'])

.config(function($routeProvider) {

    $routeProvider.
        when('/index.html/page1/', {templateUrl : './templates/template1.html'}).
        when('/index.html/page2/', {templateUrl : './templates/template2.html'}).
        otherwise({redirectTo : '/index.html/page1/'});
});
like image 148
Booker Avatar answered Oct 24 '22 13:10

Booker