• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • 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.

Posts: 2968
  • Mark post as helpful
  • send pies
  • 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.

    Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
    Thread Boost feature
      Bookmark Topic Watch Topic
    • New Topic