javascript - Unable to send data from factory into angularJs modal -
this follow-up question angular-ui modal, sending data modal controller $http
i have following code want data via factory
modal.
$scope.docsetup = function() { var modalinstance = $modal.open({ templateurl : '/templates/dialog/docsetup.html', controller : 'docsetupdlgctrl', resolve : { dlgdata : function(){ return tagservice.list($scope.publication.id); } } }); modalinstance.result.then(function (dlgdata) { $log.debug(dlgdata); }, function () { $log.debug('modal dismissed at: ' + new date()); }); };
and here factory:
app.factory("tagservice", function($http, $log){ return { list: function(selecteddoc){ $log.info("tag service @ work => list"); var httppromise = $http.post("tags/list", { publicationid: selecteddoc }); httppromise.then(function (response) { $log.log(response.data); return response.data; }, function (error) { $log.error(error); }); } } });
the above isn't resolving data dlgdata
. factory producing data , if hardcode data object 'resolve' function, passes it.
return
entire httppromise
well:
return httppromise.then(function (response) { $log.log(response.data); return response.data; }, function (error) { $log.error(error); });
Comments
Post a Comment