Angular 2 observable subscription not triggering

The same service instance isn’t being shared across your App and Home components because you have listed SidenavService as a provider for both. When you define service provider in the providers entry of a Component decorator, that service is then available to that component and all of its children as a singleton, meaning the same … Read more

How to use jsPDF with angular 2

I have done it, after doing lot of R&D , their are few steps to follow as below : Install : npm install jspdf –save typings install dt~jspdf –global –save npm install @types/jspdf –save Add following in angular-cli.json: “scripts”: [ “../node_modules/jspdf/dist/jspdf.min.js” ] html: <button (click)=”download()”>download </button> component ts: import { Component, OnInit, Inject } from … Read more

What is observable, observer and subscribe in angular?

Here is a simple visual to see the difference: As seen above … an Observable is a stream of events or data. They are often returned from Angular methods, such as the http.get and the myinputBox.valueChanges. Subscribing “kicks off” the observable stream. Without a subscribe (or an async pipe) the stream won’t start emitting values. … Read more

how to use underscore.js library in angular 2

For a project based on, I needed to do the following: 1) Import libraries npm install underscore –save npm install @types/underscore –save 2) in, add underscore to array ‘types’: “types”: [ “underscore” ] 3) In any component file I need to use underscore, I add this import * as _ from ‘underscore’; 4) … Read more