0

Hopefully I can explain this properly. On the Angular tutorial, you can use partials doing this:

phonecatApp.config(['$routeProvider',
  function($routeProvider) {
    $routeProvider.
      when('/phones', {
        templateUrl: 'partials/phone-list.html',
        controller: 'PhoneListCtrl'
      }).
      when('/phones/:phoneId', {
        templateUrl: 'partials/phone-detail.html',
        controller: 'PhoneDetailCtrl'
      }).
      otherwise({
        redirectTo: '/phones'
      });
  }]);

We've all done it and it works great, but for the first time I'm using a different login.html page that doesn't have anything in common with the rest of the pages. Is there a way I can use ngRoute to setup the controller and just load the entire login.html page instead of pointing it at a partial?

m0ngr31
  • 791
  • 13
  • 29
  • Is the problem that you have `ng-view` wrapped in a page that has design elements that are undesirable for the login template? If so, you might consider refactoring so that all view material appears inside of templates. – Marc Kline Jun 04 '14 at 18:07
  • Right. The index page I have my ng-view in that I'm using with all my partials is completely different from the login page. I could just do the header and put the ng-view on the body, but that seemed pretty lame to have all the templates have all the same stuff (top and side navs), plus I use different CSS files for the login vs index. – m0ngr31 Jun 04 '14 at 18:15
  • You wouldn't necessarily have to duplicate the HTML code in every template - you could create more partials. And you could load the css dynamically regardless of how you go about this. I think your only other alternatives are to use ng-show/hide on the elements you wish to hide on login... Or, move the login into a separate page/app which, given that you're dealing with login, will probably be a headache. – Marc Kline Jun 04 '14 at 18:25
  • 2
    I didn't think about having multiple partials. I guess I could just create a partial for the top and side navs and just throw and ng-if on it or something to check if it's the login page. Thanks for the suggestion! – m0ngr31 Jun 04 '14 at 18:35

0 Answers0