Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8818019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:59:41+00:00 2026-06-14T04:59:41+00:00

I have a service: (angular .module(‘app.services’, [‘ngResource’]) .factory(‘MyService’, [ /******/ ‘$resource’, function ($resource) {

  • 0

I have a service:

(angular
 .module('app.services', ['ngResource'])
 .factory('MyService', [
     /******/ '$resource',
     function ($resource) {
         return $resource('myurl');
     }
 ])
);

I need to create an instance of it in my code. I know that angular can inject it if I list it as one of the parameters, but I am not asking about that. I need to create an instance of it “manually”. How is it done?

EDIT:

this is related to my other question: a controller and its dependencies in a template

basically, I have a generic controller that takes a service as a parameter, and I need to create this controller manually using $controller object (to be able to use it in my template – please see the referenced question), and I need to supply a service object to it. My service needs an integer as a parameter, so I need to instantiate the service and set this integer on it as a property. Otherwise of course I would have just given the name of the service as a string to the $controller.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T04:59:42+00:00Added an answer on June 14, 2026 at 4:59 am

    See if $injector suits your needs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a certain angularjs service below.. angular.service('SubmitPayment', function($resource){ return $resource('api/SubmitPayment', {}, { query:
I have a separate services module and I need a service injected into the
Please find below the directive which i wrote, angular.module('netVogue.directives', []). directive('set-First-Active', function() { return
My app.js contains var app = angular.module('myApp', []). config(['$routeProvider', function ($routeProvider, $http) { ...
I have service url : please check it , It's return json string. I
I can get a json from some services in Angular function, however, there are
In my AngularJS node.js app based on angular-express-blog and express-coffee I have an issue
I have a working Angular.js app with HTML5 mode enabled. $location.Html5mode(true).hashbang(!); What I want
I have a .Net server app (holding WCF REST JSONP service) and a javascript
I have a service app that creates AppDomain's during the course of its use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.