Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Angular JS : Syntax for passing the parameters to the factory for REST call

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Experts,

In my Angular JS project there is a requirement where I had to make a REST call to the backend with some input parameters.
I have the input parameters inside my controller as ngModel but how to pass this inside a factory is something I am struggling with.

Kindly provide hints for the proper syntax.

Thanks,
Faraz
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
  • Your factory declaration should return a function object that accepts your parameters.
  • List the factory as a dependency in the controller initializer.
  • Use the function object that was passed as the dependency into the controller and invoke the function object with the parameters.


  •  
    reply
      Bookmark Topic Watch Topic
    • New Topic