Two views sharing same controller

82 Views Asked by At

I have a view which is basically a trimmed down version of the original template. I have trimmed down the view to only the elements I need. I can access the trimmed down view at '/newclientloanaccount/6'. Original view is accessible at '/newclientloanaccount/:clientId'. Now as I add back elements in the original template these same elements are re-appearing in the trimmed view. In both templates I'm using the same controller. The frontend is in AngularJS 1.0 Bootstrap. I want to know how I can use state provider in my route configuration so that the trimmed view renders its content correctly.

In my route config I have:

(function(weseX) {
    var defineRoutes = function($routeProvider, $locationProvider) {
        $routeProvider
          .when('/newclientloanaccount/:clientId', {
            templateUrl: 'views/loans/newloanaccount.html'
          })
          .when('/newclientloanaccount/6', {
              templateUrl: 'views/loans/loancalculator.html'

And in both views I have :

<div ng-controller="NewLoanAccAppController" class="content-container">
0

There are 0 best solutions below