Questions tagged [angular-services]

Angular services are substitutable objects that are wired together using dependency injection.

Angular services are substitutable objects that are wired together using dependency injection (DI). You can use services to organize and share code across your app.

are:

  • Lazily instantiated: Angular only instantiates a service when an application component depends on it.
  • Singletons: Each component dependent on a service gets a reference to the single instance generated by the service factory.

Reference

https://docs.angularjs.org/guide/services

2054 questions
0
votes
2 answers

angular 2 constructor inside service working another functions inside services not working

my code component.ts page: import {Component, OnInit, NgModule, VERSION} from '@angular/core'; import {BrowserModule} from '@angular/platform-browser'; import { UserService } from "../services/user.service"; import {Router, ActivatedRoute, Params }…
kathir
  • 4,255
  • 2
  • 15
  • 25
0
votes
2 answers

Load Image According to ID from LocalStorage in Angular 4

Can I reference an ID from local storage so that I can assign what image should appear? I have the list of images in the AngularJS app under assets/ folder. How can I get the ID of the current user and reference it so I have a dynamic image? If user…
user8743396
0
votes
3 answers

Disable Only Button If Either Rows Empty Angular

I have this 2 rows in 2 tables in angular that has only one submit button and i need help since I can only disable the submit button if the 2 rows in 2 tables are empty. How can i only disable the button if only 1 of the row is empty but the other…
user8743396
0
votes
1 answer

Dynamically Theme Angular2 with value from database

I have a question in regards to the angular2+ theming. I am trying to set values in Firestore to then be fetched by and angular2+ application as it is loading and dynamically set the primary and secondary colors. In AngularJS there was a service…
Nicholas Pesa
  • 2,156
  • 2
  • 24
  • 45
0
votes
2 answers

Value not set to global variable in JS/AngularJs

I am using gulp to run and build to run my application. I am getting file contents using $http service in my index.js file and then setting value of a variable like window.variablex = "http://localhost:8080/appname". here is how I am doing it (in…
0
votes
0 answers

Passing object from service to component

I have a service generated with CLI that stores an object: public tutorial: Object = { amountMin: 5, amountMax: 5, characters: 100, spells: 100, consumable: 100, gold: 90 }; and when I import that service into the…
zmuci
  • 518
  • 1
  • 5
  • 21
0
votes
1 answer

Displaying Specific Data in Angular 2/4

I have an project api that either contains material_projects or project_services. I am confused on how would i display either one of them. If i display material_projects then i mustn't display project_services. project_services must be an empty in…
user8743396
0
votes
1 answer

is Child service inside child component visible in the Parent component?

Let's say that I have a app folder which is the root folder of my application. If I now have a child folder called "second" inside the app folder (app is the parent folder and the child folder is "second") will the child folder which also has a…
0
votes
0 answers

Angular2 custom header not setting properly

angular2 headers not setting up properly in reaction.service.ts file I have tried setup X-Comma-Sep-Arrays: true header. If i check in the devTools in chrome I am seeing Access-Control-Request-Headers:x-comma-sep-arrays and Accept:*/*. screen…
Krishna
  • 760
  • 3
  • 14
  • 30
0
votes
3 answers

Get Grand Total From Rows Total

I'm confused on how would i select all total on all rows and automatically calculate it in the grand total? Like what i did in the total, i just get the values of price and quantity but how can select all so i can able to calculate automatically.…
user8743396
0
votes
2 answers

why is http delete request not deleting the item

The dropdown service calls the http delete service which gets the id from the data in the firebase server. and then sets that id to the property idArr in http service. then that id is used to delete the database entry. but its not working. I was…
SONGSTER
  • 585
  • 3
  • 11
  • 28
0
votes
1 answer

Caching And Refreshing of Data in Angular

I have this problem in my angular app that since I'm caching data. After I'm adding something using the onCreate() function. I called the getAll() function in the successfull subscribe function in order to get the new data. However, I still don't…
user8743396
0
votes
1 answer

value change in all controller when use service in angularjs

As you can see code , i am fetching value using service . I am fetching records using service in AnotherCtrl and then add one more record in $scope and that value is also change in MyCtrl, but i don't want to update scope of MyCtrl. var app =…
Ketan Modi
  • 1,780
  • 1
  • 16
  • 28
0
votes
1 answer

How to show the login form from one component to another component?

I want to show the login form from login component if click on the sign Up menu from header component or some other component. How to do that? I have the below the code. header.component.ts @Component({ selector: 'app-header', templateUrl:…
Vel
  • 9,027
  • 6
  • 34
  • 66
0
votes
1 answer

Angular 2: Providing Service Implementation based on routes

I have an angular app animals, which displays a picture of an animal depending on the current route location. For example, /dog will display dog picture and /cat will display the cat picture on the page. To accomplish it, I have created 3 feature…
Moazzam Khan
  • 3,130
  • 2
  • 20
  • 35