I have a small application SPA
( Single Page Application ) with AngularJS
where all pages are loaded in index.html
through ng-view
.
But I added a layout with a sidebar and a few more things on that page and I call the ng-view
within that layout. That way when I load the login page this is the result:
Iwouldliketodisplayonlytheseparateloginpage,therestofthepageswouldbeincludedinthistemplate.
Whatisthebestwaytosolvethisproblem?
Index.html
.../TrechodonavBar+sideBar<divid="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div ng-view></div>
<a href="#menu-toggle" class="btn btn-default menu-toggle">Toggle Menu</a>
</div>
</div>
</div>
</div>
I did not put all the code because it is a little big, but you can already see where ng-view
is.
This is the route configuration:
$routeProvider.when("/home", {
templateUrl: "src/views/home.html",
controller: "loginCtrl"
});
$routeProvider.when("/login", {
templateUrl: "src/views/login.html",
controller: "loginCtrl"
});
$routeProvider.otherwise({
redirectTo: "/login"
});
});
Update: script that worked before and now with new solution no longer works:
<script>
$(".menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
</script>
Button that stays in navBar
that is now separated on another page:
<button type="button" class="navbar-toggle collapsed menu-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>