using external JS libraries in my angular 2 project

If you use angular-cli, you can add all your external JS files in assets folder. And then in angular-cli.json add them: “scripts”: [ “../node_modules/jquery/dist/jquery.min.js”, “../node_modules/bootstrap/dist/js/bootstrap.min.js”, “../node_modules/moment/moment.js”, “../node_modules/chart.js/dist/Chart.bundle.min.js”, “../node_modules/chart.js/dist/Chart.min.js”, “../node_modules/ng2-datetime/src/vendor/bootstrap-datepicker/bootstrap-datepicker.min.js”, “./assets/js/slimscroll.min.js”, “./assets/js/inspinia.js”, “./assets/js/metisMenu.js”, “./assets/js/footable.all.min.js” ] You can do it also with external styles: “styles”: [ “../node_modules/ng2-toastr/bundles/ng2-toastr.min.css”, “../node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss”, “../node_modules/font-awesome/scss/font-awesome.scss”, “../node_modules/ng2-datetime/src/vendor/bootstrap-datepicker/bootstrap-datepicker3.min.css”, “./assets/scss/plugins/footable/footable.core.css”, “./assets/scss/style.scss” ] And of course you … Read more

How to convert input value to uppercase in angular 2 (value passing to ngControl)

As @Eric Martinez suggested, you can create a local template variable, and bind the uppercase string to the value property on the input event: <input type=”text” #input (input)=”input.value=$event.target.value.toUpperCase()” /> Alternatively, you can make this a directive: @Directive({ selector: ‘input[type=text]’, host: { ‘(input)’: ‘ref.nativeElement.value=$event.target.value.toUpperCase()’, } }) export class UpperCaseText { constructor(private ref: ElementRef) { } } … Read more

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