Issue <rio-hello name=”World”></rio-hello> <rio-hello [name]=”helloName”></rio-hello> onClick of the first component I want to change the value of the second component The value (the name) should be changed from “helloworld” to “myworld”. Both components are loaded on the same page. How
Continue readingTag: angular-services
Way to inject angular FormBuilder service to dynamic component
Issue I’m trying to inject the FormBuilder service to a dynamic component this way: Template: … <div #vc></div> … Component: @ViewChild(‘vc’, { read: ViewContainerRef }) _container: ViewContainerRef; … constructor(private fb: FormBuilder, private componentFactoryResolver: ComponentFactoryResolver, private _compiler: Compiler, private _injector: Injector,
Continue readingAngular $resource endpoint with two parameters
Issue I’ve got a setup using a service to handle $resource that is as follows: Service factory(‘EventSlot’, [‘$resource’, function ($resource){ return $resource(‘/api/events/:id/slots/:slotId’, {id: “@Id”, slotId: “@slotId”}, { signup: { method: ‘PUT’ } }); }]); Calling Function EventSlot.signup({id: $scope.id, slotId: $scope.signUpSlot.id},
Continue readingAngular $resource endpoint with two parameters
Issue I’ve got a setup using a service to handle $resource that is as follows: Service factory(‘EventSlot’, [‘$resource’, function ($resource){ return $resource(‘/api/events/:id/slots/:slotId’, {id: “@Id”, slotId: “@slotId”}, { signup: { method: ‘PUT’ } }); }]); Calling Function EventSlot.signup({id: $scope.id, slotId: $scope.signUpSlot.id},
Continue readingAngular-mocks $injector doesn't return service, no $get method
Issue I am attempting to do my best at bdd with Karma and Mocha. I have created this shell of a service to try to get things going (generated from TypeScript) I have created the following test I put a
Continue readingAngular-mocks $injector doesn't return service, no $get method
Issue I am attempting to do my best at bdd with Karma and Mocha. I have created this shell of a service to try to get things going (generated from TypeScript) I have created the following test I put a
Continue readingAngularJS factory inside ng-class on body tag not working
Issue Was told to create service/factory and use it on global controller. It’s my first time hearing global controller. Anyways, I created a factory called Scroll and injected it on our main.controller.js. The function in the factory is isScrollingEnabled which
Continue readingAngular service variable updated value not reflected in component
Issue I am facing issues while accessing the service variable values inside my angular component. Navbar component is setting user as logged in inside the service and routing guard is responsible for enabling children route, but routing guard is not
Continue readingAngularJS routing inside a factory
Issue I want to create a factory for routing purposes. I want to encapsulate this in a factory because I want to exchange info from one page to another. I don’t know if this is the best practice. Please tell
Continue readingCommon POST Function for Angular through Services
Issue We are building an angular app which is having multiple functions based on GET, POST and PUT methods. For Example this.updateEmp = function (employee) { var response = $http({ method: “post”, url: “Home/UpdateEmployee”, data: JSON.stringify(employee), dataType: “json” }); return
Continue readingCorrect way Provide DomSanitizer to Component with Angular 2 RC6
Issue I’m attempting to use DomSanitizer to sanitize a dynamic URL within a Component using I can’t seem to figure out what the correct way to specify a Provider for this service is. I’m using Angular 2.0.0-rc.6 Here’s my current
Continue readingDisplaying Specific Data in Angular 2/4
Issue 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 the
Continue readingDisplay Object name from Array of Array in Angular
Issue I’m confused on how would i display the categories.name in array of object. I want to display in the first td. <tr *ngFor=”let innerItem of project.project_services”> HERE–> <td>{{ innerItem.categories.[name]}</td> <td>{{innerItem.service.sku}}</td> <td>{{innerItem.service.name}}</td> </tr> Solution <tr *ngFor=”let innerItem of project.project_services”> <td
Continue readingDo I need Backend-for-Frontend if I am using a framework like Angular
Issue I am using Angular for my frontend application, there is an already established backend service which I am using to retrieve data. I have no control over that backend service, it is more like a legacy system that is
Continue readingDo I need Backend-for-Frontend if I am using a framework like Angular
Issue I am using Angular for my frontend application, there is an already established backend service which I am using to retrieve data. I have no control over that backend service, it is more like a legacy system that is
Continue readingDo I need Backend-for-Frontend if I am using a framework like Angular
Issue I am using Angular for my frontend application, there is an already established backend service which I am using to retrieve data. I have no control over that backend service, it is more like a legacy system that is
Continue readingDo I need Backend-for-Frontend if I am using a framework like Angular
Issue I am using Angular for my frontend application, there is an already established backend service which I am using to retrieve data. I have no control over that backend service, it is more like a legacy system that is
Continue readingDo I need Backend-for-Frontend if I am using a framework like Angular
Issue I am using Angular for my frontend application, there is an already established backend service which I am using to retrieve data. I have no control over that backend service, it is more like a legacy system that is
Continue readingDo I need Backend-for-Frontend if I am using a framework like Angular
Issue I am using Angular for my frontend application, there is an already established backend service which I am using to retrieve data. I have no control over that backend service, it is more like a legacy system that is
Continue readingDo I need Backend-for-Frontend if I am using a framework like Angular
Issue I am using Angular for my frontend application, there is an already established backend service which I am using to retrieve data. I have no control over that backend service, it is more like a legacy system that is
Continue readingDo I need Backend-for-Frontend if I am using a framework like Angular
Issue I am using Angular for my frontend application, there is an already established backend service which I am using to retrieve data. I have no control over that backend service, it is more like a legacy system that is
Continue readingDo I need Backend-for-Frontend if I am using a framework like Angular
Issue I am using Angular for my frontend application, there is an already established backend service which I am using to retrieve data. I have no control over that backend service, it is more like a legacy system that is
Continue readingDo I need Backend-for-Frontend if I am using a framework like Angular
Issue I am using Angular for my frontend application, there is an already established backend service which I am using to retrieve data. I have no control over that backend service, it is more like a legacy system that is
Continue readingDo I need Backend-for-Frontend if I am using a framework like Angular
Issue I am using Angular for my frontend application, there is an already established backend service which I am using to retrieve data. I have no control over that backend service, it is more like a legacy system that is
Continue readingPass service/provider for specific child component to use as inject value
Issue FormService contains state for parts of form. export class ArrayComponent implements OnInit { formServices: FormService[] = []; constructor( @Inject(FormService) public parentFormService: FormService, ) { } ngOnInit(): void { // Here I create lets say 10 FormService objects, that have
Continue readingWhat is the proper way to update a parent component with a shared service in ngOnInit – Angular 13
Issue I’ve come across a situation a few times where I use a shared service in a component’s ngOnInit to update a value in another component, which just so happens to be a parent. This results in the infamous Error:
Continue readingHow to get response data of dialog box returned by a service after dialog box is closed inside parent component in angular
Issue I created interfaces for passing data to dialog box to act as reusable component. companynews-interfaces.ts export interface ConfirmDialogData { title: string; description: string; imageSrc: string; showText: boolean; modalFormData: any; } I’m calling the above interfaces in parent component for
Continue readingAngular folder structure and component services
Issue I have read many articles about Angular folder structure. It is still not clear to me where do we put component services. Shared services between components are put under shared. But what about a service that is used only
Continue readingPost service is not updating value from Angular front, but it's working in postman
Issue Here is the Request I do in Postman, it works fine, it just send a display value(string) "true"/"false" to enable or disable a tab, and then I check in the get request to get all tabs and see that
Continue readingSeperate instances of an angular service per (set of) component(s)
Issue TLDR: How do I use one instance of an Angular (6) service for one set of (instances of) components (and directives) and another one for another set of the same components. Or with more information: I am currently working
Continue readingMake sure a service is instantiated
Issue Background We’re building an Angular2 app, and are accumulating a lot of specific services relating to one module. All these services are loosely coupled to a Subject<Type> event system in the app. Instantiation via the Constructor Because these services
Continue readingPass input to Angular components via router
Issue In Angular 2, I have my routes defined in app.module.ts: const appRoutes: Routes = [ { path: ”, component: HomeComponent, }, { path: ‘admin’, component: AdminComponent, } ]; I also have an app.component which displays the menu and a
Continue readingangular ng if with async data?
Issue In my angular navbar I have a *ngIf for rather or not login/logout button should be showing *ngIf=”!authService.loggedIn() it uses a service with this loggedIn function that returns true or false loggedIn() { return this.http.get(‘http://localhost:3000/users/validateToken’) .map(res => res.json()).map(data =>
Continue readingHow to prevent any execution until got response from server in Angular?
Issue I am very new to Angular and my requirements are like below. A is a function in Service which returns true or false B is a function in Component which excepts a values from service. function A() { isSuccess:
Continue readinghow can i show the data received from backend api in angular
Issue Im currently trying to show the data of an employee after he loggin to his account, i can get the data of the employee from the backend by his username and i can console logged it , but when
Continue readingaccess DOCUMENT in useFactory
Issue I want to inject @Inject(DOCUMENT) in factory. How to inject it since it is not service therefor I can’t add it in deps. // import { DOCUMENT } from ‘@angular/common’; providers: [ { provide: APP_INITIALIZER, deps: [Document], useFactory: ():
Continue readingaccess DOCUMENT in useFactory
Issue I want to inject @Inject(DOCUMENT) in factory. How to inject it since it is not service therefor I can’t add it in deps. // import { DOCUMENT } from ‘@angular/common’; providers: [ { provide: APP_INITIALIZER, deps: [Document], useFactory: ():
Continue readingHow can I get data from service in Angular interceptor?
Issue I want to add my authentication token in the request header in my auth.interceptor.ts and I’m keeping the authentication token value in my auth.service.ts. Here’s auth.interceptor.ts @Injectable() export class AuthInterceptor implements HttpInterceptor { constructor(private router: Router, private authService: AuthService)
Continue readingAre Angular Service Modules still required?
Issue In the angular docs, it lists the types of feature modules that one can implement. One of those being a service module. https://angular.io/guide/module-types In earlier versions of Angular, you would create your service and list it in the providers
Continue readingAngular Js : '$q.defer is not a function' error
Issue After Refering this Link , I am trying to get JSON data into my angular service. Service: .factory(‘restservice’, [‘$rootScope’,’$http’, ‘$q’, ‘$log’, function($rootScope,$q, $http) { return { getData: function() { var defer = $q.defer(); $http.get(‘xyz.com/abc.php’, { cache: ‘true’}) .success(function(data) {
Continue readingAngular 7 shared service for siblings component to get data from other sibling
Issue In my Angular 7 app I have two sibling componentns… configurator component and custom stepper component. In configurator component I have some functions that get data from my API and calculate some values… I want to show the calculated
Continue readingAngular 7 shared service for siblings component to get data from other sibling
Issue In my Angular 7 app I have two sibling componentns… configurator component and custom stepper component. In configurator component I have some functions that get data from my API and calculate some values… I want to show the calculated
Continue readingAngular 7 shared service for siblings component to get data from other sibling
Issue In my Angular 7 app I have two sibling componentns… configurator component and custom stepper component. In configurator component I have some functions that get data from my API and calculate some values… I want to show the calculated
Continue readingInvalid provider for the NgModule 'DynamicTestModule' when testing a service in Angular 2
Issue I have the following service: import { Injectable } from ‘@angular/core’; import { MenuItem } from ‘./../classes/menu-item’; import { ITEMS } from ‘./../static-data/items-list’; @Injectable() export class ItemsListService { getItems(): Promise<MenuItem[]> { return Promise.resolve(ITEMS); } } The test for this
Continue readingI currently have an Angular service that contains the functionality I need. How can I have the service interact with a component?
Issue I would like to know how I can successfully have my service pass its data to the required component that is located in a different directory. Component import {Component, Inject, OnInit} from ‘@angular/core’; import {MAT_DIALOG_DATA, MatDialogRef} from ‘@angular/material/dialog’; @Component({
Continue readingHow to disable button on form for a particular time based on success of modal button?
Issue Here is the component.html code for Button that needs to be disabled on success response of the modal: <button title="Bypass Authentication" (click) = "opendobAuthModal(user.id)">Bypass Authentication</button> And the component.ts file where function is defined: opendobAuthModal(userID: number){ const modalRef = this.modalService.open(DobAuthModalComponent,
Continue readinghow to Auto Increment Image slider In Angular
Issue I am trying to Auto change Images in my Application which is coming from Array imgslider[] , I am putting the MY component FILE below import { Component, OnInit, Input } from ‘@angular/core’; import {HeadService} from ‘../service/head.service’; @Component({ selector:
Continue readingHow can I use some hardcoded data together with API in the same service in Anglular 2?
Issue I have a service which is retrieving data from API and displaying it in my component. All good, but together with the data from API I’m displaying in the component, I also want to display some hardcoded array data
Continue readingAngular 5 HttpClient GET: SUCCESSFUL if in constructor FAILS when ngOnInit
Issue I’m trying to make a http.get. Its working successfully when the code is in the constructor however when I move the code into the ngOnInit area it fails. Is there a way to use the code outside the constructor?
Continue readingTo pass selected dropdown id to another component
Issue I have an component called list where i am displaying all my customers names in the dropdown as shown below: Now on clicking/selecting particular item(i,e customer) from the dropdown i want to emit that id to the method/function present
Continue readingPrevent Angular 9 component from destruction on route change?
Issue I have an angular 9 component which is used to upload data(images) to the server. I want to prevent the component from refreshing on routing. I want the upload to continue even on changing routes. How do I achieve
Continue readingAngular 9 – how to inject dynamic parameters into a service constructor
Issue I need to make requests to a backend url which comes in this form: localhost:8000/myapp/item1/:id1/item2/:id2/item3 where id1 and id2 are dynamic numbers. I’ve thought using a service that takes 2 arguments in the constructor, something like this export class
Continue readingCan a service get access to component's template
Issue I have two service (A and B) communicating between each others, A has to build a chart when the other one received asynchronous datas (those datas are used somewhere else, so B is independant). I’ve tried to shift what
Continue readingBind click event from one component to another one
Issue Is it possible in Angular to dynamically bind a click event from a component to an existing component on the page. To illustrate, I include this screenshot. The app consists of 4 simple components now; One shell component that
Continue readingEXCEPTION in Angular 8: Can't resolve all parameters Angular 8
Issue I’ve built a app in Angular 8, but I have encountered a strange issue where I cannot inject a service into one of my components. Basically i want to show all my login/register means under one page without routing
Continue readingangularjs $httpProvider interceptor documentation
Issue I am new to angular (and programming), here is a seemingly simple question but I could not figure it out. some tutorials suggests using $httpProvider.interceptors.push(‘interceptorName’) to manipulate the http request and response. I want to know more about the
Continue readingHow to display modal Component from another Component in Angular 11
Issue I’m trying to display a modal component from another main component, but I receive 404 error from the modal component when it renders the parent component. I think beacuse is trying to access the modal component from main component
Continue readingBinding an array to a component in template is working only on page load
Issue I have a component (for a navigation bar) that is in my layout template and I’m using an injectable service so components can change the content of the navigation bar depending on their own logic. Here’s part of the
Continue readingAngular Use Multiple Instances of Service In Parent to Child Components
Issue I have a Parent Component calling the two same Child components. The child component contains a SearchForm and Grid. The two search grids are shown side by side, in iframe format. Allow users conduct two searches. When doing a
Continue readingCart quantity on header shared component is not updating from another component in Angular 10
Issue I would like the no. of items on cart icon which is on header component to be increase when I click on ‘Add to cart’ button. But the same is working only when I refresh the page. I am
Continue readingHow to get data from Firebase to Service and then to Page correctly (Angularfire + ionic4)?
Issue I am trying to get data from Firebase Realtimedatabase to my firebase.service via a function called getData() inside the firebase.service. I can get the data inside the firebase.service but I can’t load them into mypage page. I can see
Continue readingHow to get data from Firebase to Service and then to Page correctly (Angularfire + ionic4)?
Issue I am trying to get data from Firebase Realtimedatabase to my firebase.service via a function called getData() inside the firebase.service. I can get the data inside the firebase.service but I can’t load them into mypage page. I can see
Continue readingAngular package using its own service inside component
Issue I’m creating an angular library for components shared across multiple apps. I’m running into trouble when using a service from inside the library inside a component from the library. The service is intended to be injected at the root
Continue readingAngular cli service generation: service is generated in root instead of /services
Issue I’m messing around with Angular a bit. Trying to generate some stuff with angular-cli. But when generating a new service the service is placed in “/src/” folder. I would like to set a global default folder for this. Is
Continue readingget headers from get Http request in Angular
Issue I’m making a call to an API that gets blob data. back end sends to me also file name in header. My actual problem is that I can’t get header from the api. Here’s my service.ts public openFile(path) {
Continue readingAngularJS – UI Router – programmatically add states
Issue Is there a way to programmatically add states to $stateProvider after module configuration, in e.g. service ? To add more context to this question, I have a situation where I can go with two approaches: try to force the
Continue readingFailed to display value service in Angular
Issue I am trying to display service containing country code and details but I am getting error in console I am putting all the details below Error localhost/:1 Failed to load http://country.io/names.json: No ‘Access-Control-Allow-Origin’ header is present on the requested
Continue readingTrigger Angular Material toast on state change
Issue I’m currently developing an AngularJS web application, which is setup and using Angular Material. I have implemented the Angular Material Toast feature, without any problems. Also, I have setup several views using ui-router – 1. Index, 2. Parent &
Continue readingHow to extend an Angular factory
Issue I have a data services file that I want to break up into smaller modules/pieces. Currently, the code is something like the following: angular .module(‘myapp’) .factory(‘DataService’, DataService) DataService.$inject = [‘$http’]; function DataService($http) { var service = { methodOne: methodOne,
Continue readingDisplay values from API In Angular 6 page
Issue I am completely new to frontend dev and trying to display API data in an Angular 6 application and can’t figure out how to do it. I can display values in the top level of the returned details but
Continue readingnot getting updated data from service to my component1 onclick event in component2 in angular
Issue I am working on angular 9 to make news application.I am using Times of India RSS Feed API https://timesofindia.indiatimes.com Here is my stackblitz link https://stackblitz.com/github/mehulk05/Newsapp I have categroies in my home component ,so when i click on any category
Continue readingTypeError: Cannot read property '_id' of undefined angular7
Issue I have a component employee I am trying to create a form, for which I have created “employee component”, “employee service” and “employee model” In employee.component.html I have below form <form #employeeform=”ngForm” (ngSubmit)=”onSubmit(employeeform)”> <input type=”hidden” name=”_id” [(ngModel)]=”employeeservice.selectedEmployee._id” #_id=”ngModel”/> </form>
Continue readingAngular 7: Service instance working incorrectly
Issue I have two components in my app – ‘filter’ and ‘home’. These two components are child components of app component. I have a below object of which type I would like to pass from filter component to home component
Continue readingAngular 2 Shared Data Service is not working
Issue I have built a shared data service that’s designed to hold the users login details which can then be used to display the username on the header, but I cant get it to work. Here’s my (abbreviated) code: //
Continue readingAngular – Get undefined from service
Issue logdetay.service.ts import { Injectable } from ‘@angular/core’; import { Logdetay } from ‘./logdetay.model’; import { HttpClient } from "@angular/common/http"; @Injectable({ providedIn: ‘root’ }) export class LogdetayService { formData:Logdetay={ Message: null, CreateDate: null, LogType: null, Int: null }; readonly rootUrl=’https://localhost:44370/api’;
Continue readingPassing current scope to an AngularJS Service
Issue Is it correct to pass the “current” $scope to an AngularJS service? I’m in the situation where I’ve a $service knowing it’s consumed by only one controller, and I’d like to have a reference to the controller’s scope in
Continue readingWhy I can't reach the properties at Angular?
Issue I’m using a service to get data from backend. The Controller is working fine. And I can show the received object at the Angular GUI. <p> {{feedback | json}} </p> The output looks like this: { "id": 1, "comment":
Continue reading