angular2-services Questions

4

My html call to this component <navbar [title]="'Recorridos'" [hasNavbarItems]="true" [itemsJsonFileName]="'recorrido-list-navbar-items.json'" (btnActionClicked)="onBtnActionClicked($event)...
Particulate asked 14/10, 2016 at 21:16

3

Solved

I have watch a few courses on Angular and have found there are different ways to manage data from an Http request. Using Observables, .map(), .subscribe() Using Promises, .toPromise(), .then(), ....
Walley asked 1/9, 2016 at 7:41

4

Solved

I am trying to return an observable after a successful completion of my Promise, but that function is not returning Observable. To be specific to code, i want to fetch auth token from storage (ret...
Refrain asked 11/1, 2017 at 7:59

6

I have a Component and a Service: Component: export class WebUserProfileViewComponent { persons: Person []; personId: number; constructor( params: RouteParams, private personService: PersonS...
Pyromorphite asked 22/6, 2016 at 13:45

3

Solved

This is function to download pdf file in angular 2 when I am downloading Pdf file it is corrupted file. So how do I solve this problem. It is displaying corrupted data like this. %PDF-1.5 %���� ↵66...
Tattan asked 22/8, 2017 at 11:1

4

Solved

I tried to import the http provider into a service, but I'm getting the following error: Cannot resolve all parameters for 'AppService'(?). Make sure that all the parameters are decorated with I...

3

Solved

I want to create service, which can interact with one component. All another components in my app, should be able to call this service, and this service should interact with this component. How to...

2

Solved

I repeatedly run into a situation where I'd like to access a child component existing on the other side of a router outlet rather than a selector: Like: <router-outlet></router-outlet>...
Urticaria asked 31/8, 2016 at 17:8

2

I have an Angular service that shares a data stream (http call) to several components asynchronously. I need to recall the http service based on user action once in a while. I am using a ReplaySu...
Head asked 25/1, 2017 at 18:48

3

Solved

I have a parent service which has some dependencies like @Injectable() export class ParentService{ constructor(private http:Http, private customService:CustomService){} } and I want to extend t...
Orling asked 29/8, 2016 at 14:12

4

Solved

I was trying to figure out how to get a menu to appear and disappear based on being logged in in a previous post. But I think a better and possibly easier question would be, how can I watch for cha...
New asked 14/2, 2016 at 19:41

3

Solved

Angular2 rc.6 I am getting following error when running a loop on json data core.umd.js:5995 EXCEPTION: Error in app/modules/mbs/components/menu.html:5:4 caused by: Cannot find a differ supporting ...
Jocular asked 15/9, 2016 at 20:13

3

Solved

I have an async function in my angular2 app for which I want to write a unit test. Imagine my function is like this: myFunc(a: int): Promise<void> { if (a == 1) throw new Error('a should n...

4

I need to use the FileSaver.js (https://github.com/eligrey/FileSaver.js/) in my Angular2 application. I know I can add it as a script file in main html page and it will work. But I was wondering w...

3

I have two component in my angular 2 application : component A (parent) and component B (child). When i passe data (myData) from A to B with @Input() i get my data in my B (child component), but t...
Crossrefer asked 25/8, 2016 at 13:58

3

I've found no information whether lifecycle hooks are supported on Angular 2 services, neither in the official documentation, nor on the web. Most hooks do not make sense, but at least ngOnInit() c...
Kowloon asked 30/1, 2017 at 18:20

1

Solved

I'm brand new to Angular2 and trying to write a test in the app.component.spec.ts file. My application is relatively simple, besides the fact that it imports LoginComponent and LogoutComponent from...

3

I want to get date in the following format: YYYY-MM-DD. I wrote a date service in Angular2 based on this question: How do I get the current date in JavaScript?. I wanted to check if it is...
Prospective asked 5/9, 2017 at 18:56

3

Solved

I need to create a dynamic menu after user logged in successfully and redirected to home page using Angular 2. Exactly like in the first similar question except I cannot hardcore the menu items. A...
Franglais asked 15/11, 2016 at 21:50

5

I've been following this tutorial, to understand lazy loading, and below is my inference. Scenario 1: Services are provided by putting them in the providers array of a child module Scenario 2: Se...

3

Solved

How can I introduce something like 'my-app-name/services' to avoid lines like the following import? import {XyService} from '../../../services/validation/xy.service';
Istic asked 21/1, 2016 at 14:8

2

I'm working on my unit test cases for Angular 2 with Karma, I got stuck with one of a function where I run the test for below line expect(component.subscribeToEvents()).toBeTruthy(); and I view...

1

I have a component that calls a service to see if a subscription has been announced from another component. Component: this.activateProcessReadySubscription = this.returnService.processReadySubsc...
Lindberg asked 23/6, 2017 at 19:35

3

What is the need of redux because we can also save and get data from services, as far as I understand we can also get and save data into services and those services could be used by other com...
Miscreated asked 12/8, 2016 at 5:5

1

I noticed that my Angular 2 app gets painfully slow after a while of usage. I profiled the CPU time and found out that there are massive change detection executions going on. CPU profile right ...
Hyaloid asked 4/3, 2016 at 14:59

© 2022 - 2024 — McMap. All rights reserved.