javascript - angular js modal popup call factory function -


I am trying to call the factory function in my modal popup but this error returns

This is my factory

  .factory ('PartnerFactory', ['$ http', '$ rootScope', function ($ http, $ rootScope) {var current partner; var partners = [ ]; Var current client; var current site refund {savePartner: function (partnerData) {console.log ("in partner save"); console.log (partnerData); var url = "/ api / partner / createpartner" var datatpost = {Name: partnerData.Name, Description: partnerData.Description, Address1: partnerData.Address1} / $ / Http: // $ http.post (url, dataToPost) .vivet (function (data) {}) .error (function (data) {// return $ scope.showInfoOnSubmit = ! 0, $ scope.revert ()}), getPartners: function () {var url = "/ api / partner / getAllPartners"; return $ http.get (url). Then (function (feedback) {partners = response data; $ Rootscope. $ Broadcast ('handle shared partner', partners); Return partners;})}}}}}   

modal dialog

  .controller ("PartnerModalCtrl", ["$ scope", "$ http "$ ModalInstance", "item", '$ routeParam', 'PartnerFactory', function ($ scope, $ http, $ modalInstance, $ routeParams, PartnerFactory) {$ scope.test = function (partnerData) {console. Return (return); console.log (partnerData); return it to partner partner. Career partner ();}, $ Scope.ok = function () {$ modalInstance.close ();}, $ Scope.cancel = Function () {$ modalInstance.dississ ("cancel")}, $ scope.addPartner = function (partnerData) {console.log}; Return PartnerFactory.savePartner (partnerData);}}}])   

get the error as I add The partner is not a defining function

factory:

  savePartner : Function (partnerData) {console.log "in saving companion"); Console.log (partnerData); Var url = "/ API / Partner / CreatePreser"; Var dataToPost = {name: partnerData.Name, Description: partnerData.Description, address1: partnerData.Address1} //// $ ("#spinner"). Show (); $ Http.post (url, dataToPost) .success (function (data) {// need to return data from function return data;}). Terror (data) {// return $ scope.showInfoOnSubmit =! 0, $ Scope.revert ()}), getPartners: function () {var url = "/ api / partner / getAllPartners"; Return $ Http.get (url). Then (function (response) {partners = response_data; $ Rootscope. $ Broadcast ('handle shareer', partners); return partners;})}}; Controller:  
  .controller ("PartnerModalCtrl", ["$ scope", "$ http", "$ modalInstance", "item", '$ route param', 'partnerfactor', function ($ Radius, $ http, $ modalInstance, item, $ routeParams, PartnerFactory) {$ scope.test = function (partnerData) {console.log ("test"); console.lag (partnerdata); return it back partner fracturecure partner ();}, $ Scope.k = function () {$ modalInstance.close ();} $ scope.cancel = function () {$ modalInstance.dississ ("Cancel")} $ scope.addPartner = function (partnerData) ) {Console.log (partnerData); Return PartnerFactory.savePartner (partnerData);}}}])   

If the problem persists a bay So that we can see the whole code

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -