title: Angular resolve in component
body: <p>I have an ui.router state in which I need to resolve some data, but it seems to resolve after loading the controller and before loading the template.</p>
  
  <p>State definition looks like:</p>
  
  <pre><code>$stateProvider
           .state( 'route', {
              url: '/update/:id',
              template: '&lt;update order="$resolve.order"&gt;&lt;/update&gt;',
              resolve: {
                  order: function( OrdersService, $stateParams ) {
                      return OrdersService.get( $stateParams.id ).$promise
                  }
              }
          } )
  </code></pre>
  
  <p>Component:</p>
  
  <pre><code>const Update = {
      bindings: {
         order: "&lt;"
      },
      controller,
      template
  };
  
  angular.module( 'app' )
      .component( 'update', Update );
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>export default class UpdateCtrl {
      constructor(){
           ...
           console.log(this.order);
           ...
      }
  }
  </code></pre>
  
  <p>OrdersService:</p>
  
  <pre><code>class OrdersService {
      constructor( $resource, api_name ) {
          this.$resource = $resource( api_name + '/orders/:id', { id: '@id' }, {
              get: { method: 'GET' }
          } );
      }
      get( orderId ) {
          return this.$resource.get( { orderId } );
      }
  }
  angular.module( 'app' )
      .factory( 'OrdersService', [
          '$resource',
          'api_name',
          ( $resource, api_name ) =&gt; new OrdersService( $resource, api_name )
      ] );
  </code></pre>
  
  <p>All imports are fine, and I still get following from controller, and full data in template</p>
  
  <pre><code>console.log(this.order) // undefined
  </code></pre>
  
  <p>P.S. I found some strange behavior when I call <code>console.log(this.order,this)</code> in the controller constructor.<br>
  It prints to console</p>
  
  <pre><code>undefined OrderUpdateCtrl
               $stateParams:Object
               OrdersService:OrdersService
               order:Resource // full resolved object
               __proto__:Object
  </code></pre>