angular2-services Questions
6
Solved
I have a constant file
export class constants {
public static get API_ENDPOINT(): string { return 'https://dvelopment-server/'; }
}
And I imported it to my service
private _registrationUrl =...
Jotunheim asked 15/3, 2016 at 7:18
4
Solved
I'm trying to make some sort of communication between my components, so I'm using a service with a BehaviorSubject and Subscription in the components like this:
Service (code related to the proble...
Continuance asked 14/9, 2016 at 19:53
8
Solved
I want to shift the logic from component to service. But I found out that I can't get the routeParams in a service.
My component looks like
import { Component, OnInit } from '@angular/core';
impo...
Disgorge asked 24/10, 2016 at 13:31
6
Solved
Context
I created an ApiService class to be able to handle our custom API queries, while using our own serializer + other features.
ApiService's constructor signature is:
constructor(metaManager: M...
Nathannathanael asked 13/9, 2016 at 14:20
5
Solved
I am working on an angular2 project, I have a file in assets folder and I have created a button to download the file while running the app.
I see there are quite a many solutions to the above pro...
Gileadite asked 18/6, 2018 at 10:33
3
Solved
I'm new to angular 2 and I'm trying to make a REST GET request, but I'm getting this error when trying:
error TS2339: Property 'then' does not exist on type 'Observable<Connection[]>'.
Her...
Pires asked 6/12, 2016 at 0:3
6
Solved
I want to use a static variable of a component in HTML page.
How to bind static variable of component with a HTML element in angular 2?
import { Component, OnInit } from '@angular/core';
import {...
Domoniquedomph asked 28/8, 2016 at 16:42
4
Solved
I have a service, like this:
@Injectable()
export class EditorService { ... }
And I have a component, like this:
@Component({
...
template: `<child-component></child-component>`,
pr...
Raiment asked 20/7, 2016 at 13:14
7
So I am trying to subscribe to a simple service that return data from a local JSON file.
I have managed to get the service working, I can log it out in the function, but when I subscribe to the s...
Islington asked 16/10, 2017 at 11:16
4
I understand that provider is for getting service from another class but what is multi-provider and token thing?
And also when we do multi=true ?
provide(NG_VALIDATORS, { useExisting: class), mul...
Williswillison asked 1/7, 2016 at 11:45
2
Solved
I am building a web application using angular 2 in which I want to have multiple components listening to the same service. This service returns an observable that returns incoming data from a webso...
Dipteral asked 27/8, 2016 at 17:19
5
Solved
I'm wondering if I can make just a http post request without subscribing on callbacks, something like this
this._http.post('/list/items/update?itemId=' + itemId + "&done=" + done, null);
in...
Singlecross asked 23/12, 2016 at 6:9
4
I want to check which component/service is calling the method of a certain service, without passing additional parameters. This needs to be checked in the service. Please mention if there's any way...
Carvel asked 10/1, 2018 at 13:18
7
Solved
In my application, I have two different bootstrap module (@NgModule) running independently in one application. There are not one angular app bit separate bootstrap module and now I want they should...
Chasechaser asked 17/10, 2016 at 14:40
3
I am new to development using Angular 4. I am facing an issue while getting a response from API about displaying an image. In the API, an image file has an input-stream file. I don't know how to re...
Vistula asked 6/8, 2017 at 9:52
3
Solved
Looks like shared services is the best practice to solve many situations such as communication among components or as replacement of the old $rootscope concept of angular 1. I'm trying to create mi...
Saire asked 27/3, 2016 at 19:3
2
Solved
I'm trying to get the updated value from a service variable (isSidebarVisible) which is keeps on updated by another component (header) with a click event (toggleSidebar).
sidebar.service.ts
import ...
Antelope asked 1/4, 2017 at 16:8
2
Solved
What is the difference between EventEmitter.emit() and EventEmitter.next()? Both dispatching the event to the subscribed listeners.
export class MyService {
@Output() someEvent$: EventEmitter<...
Alcot asked 7/3, 2016 at 9:51
3
Solved
I have two component A and B, where component A contains a button. I wish when user click on this button, fire a function on component B
<A></A>
<router-outlet></router-outlet...
Magdau asked 31/1, 2017 at 13:27
1
I use google map API in my application like this :
import url with api key in index.html :
<script src="https://maps.googleapis.com/maps/api/js?key=myKey"></script>
and in component...
Arsphenamine asked 9/10, 2017 at 12:19
4
Solved
I am using ngx-progressbar bar in Angular 2 application. When app loading first it is working fine. second time it is showing error. I referred few article like medium.com for subscribe object. I d...
Asante asked 17/4, 2017 at 8:19
2
Solved
I have injected class as dependency injection in component class and get an error
NullInjectorError: No provider for class
Here is my code:
// Component
import { Formation } from './Models/Format...
Lucilius asked 26/2, 2018 at 12:26
3
Solved
I've just run into a problem with a lazy-loaded module where parent and child module both require the same service but create an instance each. The declaration is identical for both, that is
impor...
Occlusion asked 24/9, 2016 at 5:18
2
I'm using ngx bootstrap datepicker in the project
Needed only month and year to be selected like the above image
<input type="text"
class="form-control"
(bsValueChange)="modelChanged($ev...
Bulbous asked 8/3, 2018 at 4:51
6
Solved
I was looking to experiment with a forkJoin mainly using the accepted answer here:
Angular2 Observable.forkJoin of observable variables - ReferenceError: Observable is not defined
I'm getting the...
Kappenne asked 18/7, 2016 at 18:36
© 2022 - 2024 — McMap. All rights reserved.