title: Complex states with Angularjs and ui-router
body: <p>I'm building a week view calendar with Angular and UI-router, and have run into a couple of problems regarding states, and scopes.</p>
  
  <p>My first problem is with navigating to a different week. With my url <code>/schedule/2015/W31</code>, I've only been able to change the year and week (without reloading the controller) by using <code>$location.path(...)</code>, and updating the calendar on <code>$locationChangeSuccess</code>. This is obviously not ideal. Is there a better option? ... preferably without using query strings.</p>
  
  <p>Further to that, I have my default state <code>schedule</code> which displays my calendar, and action buttons at the top:</p>
  
  <p><a href="https://i.stack.imgur.com/BDgtL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BDgtL.png" alt="Calendar"></a></p>
  
  <p>When I click the <code>+ Add</code> button, I move to a state <code>schedule.add</code> which switches out the actions for buttons such as <code>Cancel</code> and <code>Done</code>.</p>
  
  <p>My issue is that because I'm trying to persist the calendar across the states, using child states and <code>reloadOnSearch: false</code>, any <code>ng-click</code> on the buttons refers to the <code>schedule</code> scope. Here's the config for these states.</p>
  
  <pre><code>$stateProvider
      .state('schedule', {
          url: '/schedule/:year/{week:W[0-9]{2}}',
          controller: 'ScheduleController',
          templateUrl: 'sections/week/week.html',
          reloadOnSearch: false
      })
      .state('schedule.add', {
          url: '/add',
          views: {
              view: {
                  template: '',
                  controller: 'ScheduleAddController'
              }
          },
          reloadOnSearch: false
      });
  </code></pre>
  
  <p>I was hoping that this way of building the calendar would enable me to use a different state and controller for each piece of functionality of the calendar (i.e. rescheduling, and tons of other functions it has to do.)</p>
  
  <p>Thanks for any input!!</p>