angular5

change XLSX column datatype to number in Angular 5

孤街醉人 提交于 2020-06-28 11:05:21
问题 i am using xlsx library for export to excel ( "xlsx": "0.16.1" ) i have three columns with thousand separator number, so when i export that data then it will consider as a string, but i want number type, here is code of Export to Excel file public downloadExcel(json: any[], excelFileName: string, merges?: any): void { let worksheet: XLSX.WorkSheet; if (merges) { worksheet = XLSX.utils.aoa_to_sheet(json); worksheet['!merges'] = merges; } else { worksheet = XLSX.utils.json_to_sheet(json); }

Angular 5 - Display Embedded PDF from byte[]

邮差的信 提交于 2020-06-27 16:50:32
问题 I'm relatively new to Angular 5.0, and have read the documentation but I can't seem to make any progress. I have a .Net Core 2.0 project with an Angular 5 UI and am passing a byte[] of a PDF file from the API Controller to Angular. I would like to then embed this PDF file via Object/Embed/Iframe in my view. So far I have the following: Controller: [HttpGet] [Route("api/PdfReports/GetReport")] public byte[] Get() { string directory = System.IO.Directory.GetCurrentDirectory(); string fileName =

How can I get all the rows of ag-grid?

断了今生、忘了曾经 提交于 2020-06-25 08:57:50
问题 ag-grid provides a way to get selected rows using api.getSelectedRows() function. And provides a way to set all rows using api.setRowData([]) function. I'm looking for something getAllRows() to return all the rows in the grid. I know there is a way to loop through all the rows using api.forEachNode() etc. Is there any way I can get the entire array of rows? 回答1: I don't think there is such a method but you can make your own: getAllRows() { let rowData = []; this.gridApi.forEachNode(node =>

Upload file using angular material 5

北城余情 提交于 2020-06-23 07:16:52
问题 I tried to upload file (angular 5) using angular material 5. app.component.html <mat-horizontal-stepper [linear]="isLinear" #stepper="matHorizontalStepper"> <mat-step [stepControl]="firstFormGroup"> <form [formGroup]="firstFormGroup"> <ng-template matStepLabel>Upload your audio file</ng-template> <mat-form-field> <input matInput style="display: none" type="file" (change)="onFileSelected($event)" #fileInput name ="file" formControlName="firstCtrl" required> <button mat-button (click)=

Use mat-button-toggle-group inside a mat-grid

こ雲淡風輕ζ 提交于 2020-06-17 09:52:05
问题 I have 5 buttons occupying 5 columns of a mat-grid . The buttons should behave as toggle buttons and all 5 should belong to a single group. I tried enclosing the mat-grid with mat-button-toggle-group , but still isn't working. Any help is much appreciated. Code : <mat-grid-list cols="11" rowHeight="40px"> <mat-grid-tile > <label>Label 1</label><!-- below buttons should be a single group --> </mat-grid-tile> <mat-grid-tile colspan='2'> <mat-button-toggle >Button 1</mat-button-toggle> </mat

sweetalert_1.default is not a function : Angular 5

那年仲夏 提交于 2020-06-17 00:50:33
问题 I'm about discovering SweetAlert in the official link , so i wanted to use it in my app angular5 . i have installed it this way : npm install sweetalert --save I have imported it in my component : edit-client.component with this : import swal from 'sweetalert'; Here is the file editClient.component.ts where i tried to use it : import swal from 'sweetalert'; Component({ selector: 'app-edit-clients', templateUrl: './edit-clients.component.html', styleUrls: ['./edit-clients.component.scss'] })

How to inherit css styles in child component from parent in Angular 5

霸气de小男生 提交于 2020-06-13 13:53:15
问题 I have a parent component inside which I have a child component. The parent component have some css classes, where child component extends them. I tried to use :host as looking at documentation, but cant't seem to get it work properly. child component: <div class="table-row body"> <div class="table-cell body-content-outer-wrapper"> <div class="body-content-inner-wrapper"> <div class="body-content"> <div>This is the scrollable content whose height is unknown</div> <div>This is the scrollable

How to inherit css styles in child component from parent in Angular 5

巧了我就是萌 提交于 2020-06-13 13:51:08
问题 I have a parent component inside which I have a child component. The parent component have some css classes, where child component extends them. I tried to use :host as looking at documentation, but cant't seem to get it work properly. child component: <div class="table-row body"> <div class="table-cell body-content-outer-wrapper"> <div class="body-content-inner-wrapper"> <div class="body-content"> <div>This is the scrollable content whose height is unknown</div> <div>This is the scrollable

Trigger keyup event in Angular 5 TypeScript

ⅰ亾dé卋堺 提交于 2020-06-13 05:47:09
问题 We have triggered keypress/down/up events programmatically easily with JavaScript/jQuery. $(function() { $('item').keydown(); $('item').keypress(); $('item').keyup(); $('item').blur(); }); But with Angular 5 and TypeScript, how can we do that? //I am setting value programmatically -> working document.getElementById('custom_Credit').setAttribute('value', coinsToBuy); //setting focus -> working document.getElementById('custom_Credit').focus(); //but there are no way to generate or trigger

Angular 5 Injector - How to inject string

狂风中的少年 提交于 2020-06-12 06:47:52
问题 I am trying to inject strings into my angular component. The code below works fine but it gives a deprecation warning: get is deprecated: from v4.0.0 use Type or InjectionToken @Component({ selector: 'app-label', templateUrl: './label.component.html', styleUrls: ['./label.component.scss'] }) export class LabelComponent { public name: string; public caption: string; constructor( private injector: Injector ) { this.name = this.injector.get('name'); this.caption = this.injector.get('caption'); }