All Questions

137
votes
6answers
74244 views

Delegation: EventEmitter or Observable in Angular

I am trying to implement something like a delegation pattern in Angular. When the user clicks on a nav-item, I would like to call a function which then emits an event which should in turn be handled ...
40
votes
4answers
27932 views

How to pass parameters rendered from backend to angular2 bootstrap method

Is there a way to pass arguments rendered on the backend to angular2 bootstrap method? I want to set http header for all requests using BaseRequestOptions with value provided from the backend. My main...
180
votes
4answers
94023 views

Triggering change detection manually in Angular

I'm writing an Angular component that has a property Mode(): string. I would like to be able to set this property programmatically not in response to any event. The problem is that in the absence of a...
224
votes
18answers
235879 views

How to use jQuery with Angular?

Can anyone tell me, how to use jQuery with Angular? class MyComponent { constructor() { // how to query the DOM element from here? } } I'm aware there are workarounds like manipulat...
411
votes
15answers
173490 views

Difference between Constructor and ngOnInit

Angular provides life cycle hook ngOnInit by default. Why should ngOnInit be used, if we already have a constructor?
225
votes
8answers
132639 views

Angular HTTP GET with TypeScript error http.get(...).map is not a function in [null]

I have a problem with HTTP in Angular. I just want to GET a JSON list and show it in the view. Service class import {Injectable} from "angular2/core"; import {Hall} from "./hall"; import {Http} f...
26
votes
7answers
26079 views

What's the best way to inject one service into another in angular 2 (Beta)?

I know how to inject a service into a component (via @Component), but how can I use DI to pass around services outside of components? In other words, I don't want to do this: export class MyFirstSvc...
109
votes
2answers
85347 views

What is the proper use of an EventEmitter?

I've read questions like Access EventEmitter Service inside of CustomHttp where the user uses EventEmitter in his service, but he was suggested in this comment not to use it and to use instead Obser...
153
votes
10answers
75558 views

*ngIf and *ngFor on same element causing error

I'm having a problem with trying to use Angular's *ngFor and *ngIf on the same element. When trying to loop through the collection in the *ngFor, the collection is seen as null and consequently fail...
122
votes
12answers
124302 views

access key and value of object using *ngFor

Bit confused about how to get Key and Value of object in angular2 while usng *ngFor for iteration over object. i know in angular 1.x there is syntax like ng-repeat="(key, value) in demo" but in an...

Previous Next