Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's an example of the code I've used in the application I'm working on, not sure it will help much because its not much different than how you have it already.</p> <p><strong>Routing</strong></p> <pre><code>.when('/view/proposal/:id',{ controller : 'viewProposalCtrl', templateURL : 'tmpls/get/proposal/view', resolve : viewProposalCtrl.resolveViewProposal }) </code></pre> <p><strong>Controller</strong></p> <pre><code>var viewProposalCtrl = angular.module('proposal.controllers') .controller('viewProposalCtrl',['$scope','contacts','details','rationale', function($scope,contacts,details,rationale){ $scope.contacts = contacts; $scope.details = details; $scope.rationale = rationale; // [ REST OF CONTROLLER CODE ] }); // proposalSrv is a factory service viewProposalCtrl.resolveViewProposal = { contacts : ['$route','proposalSrv',function($route,proposalSrv){ return proposalSrv.get('Contacts',$route.current.params.id) .then(function(data){ return data.data.contacts; },function(){ return []; }); }], details : ['$route','proposalSrv',function($route,proposalSrv){ return proposalSrv.get('Details',$route.current.params.id) .then(function(data){ return data.data.details; },function(){ return {}; }); }], rationale : ['$route','proposalSrv',function($route,proposalSrv){ return proposalSrv.get('Rationale',$route.current.params.id) .then(function(data){ return data.data.rationale; },function(){ return {}; ] }] }; </code></pre> <p>Now that I think about it, when I was developing my application I did have a problem and not sure why when I named my resolve function "resolve." This gave me a problem:</p> <pre><code>.when('/path',{ // stuff here resolve : myCtrlr.resolve }) </code></pre> <p>but this did not:</p> <pre><code>.when('/path',{ //stuff here resolve : myCtrlr.myResolveFn }) </code></pre> <p><strong>Another Possibility</strong></p> <p>The only other thing I can think of, is that you're returning the <strong>promise</strong> from the <code>$http</code> call and then trying to use <code>appData.data</code> Try using the <code>.then</code> function or one of the other functions (<code>.success</code>,<code>.error</code>) to retrieve the information from the promise.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload