angular5

How to export Excel file from Angular Material 5 Mat-Table (Angular Material Table)?

给你一囗甜甜゛ 提交于 2019-12-13 04:23:02
问题 I am new to Angular and using Angular material 5 mat-table and trying to export the table in a excel file. I have use SheetJS XLSX package. Below is my code: Table.component.html: <mat-table #table [dataSource]="dataSource" matSort> <!-- ID Column --> <!--<ng-container matColumnDef="ID"> <mat-header-cell *matHeaderCellDef mat-sort-header> UserID </mat-header-cell> <mat-cell *matCellDef="let row"> {{row.UserID}} </mat-cell> </ng-container>--> <!-- Progress Column --> <ng-container matColumnDef

Download excel file with .Net core 2 and EPPlus

人走茶凉 提交于 2019-12-13 04:16:22
问题 From an api route : api/exportExcel, i want to generate an excel file with .netCore 2.0 and EPPlus so the user can download it on his machine but the file is not generated and i have no server error. On the other hand, i have a binary content in the response : PK!rNäH­¯3[Content_Types].xmlµÏJ1Æ_eÉU´D, etc... Here's my code : [HttpPost("exportBooks")] public FileResult ExportBooks([FromBody] Books[] books) { var comlumHeadrs = new string[] { "Book Id", "Name", }; byte[] result; using (var

How to implement For loop concept for schema(nested )

…衆ロ難τιáo~ 提交于 2019-12-13 04:14:19
问题 JSON schema format which is getting in response and stored it in buttonschema { "Name": "Test", "layoutSections": [ { "layoutColumns": [ { "layoutItems": [ { "name": "test", },] },] },] } Html File to read Json schema <div *ngFor="let Schema of buttonSchema?.layoutsections"> <div *ngFor="let Schema1 of Schema?.layoutcolumns"> <div *ngFor="let Schema2 of Schema1?.layoutItems"> </div> </div> </div> Typescript File buttonSchema: any; ngOnInit() { this.buttonSchema = this.authenticationService

How to set npm root path to …/Appdata/roaming/npm

我怕爱的太早我们不能终老 提交于 2019-12-13 03:57:14
问题 I have installed nodejs ->8.12.0 and npm ->6.4.1 and trying to install angular 1.7.4 I have added environment variable path to C:\Users\user_name\AppData\Roaming\npm and C:\Users\user_name\AppData\Roaming\npm\node_modules\@angular\cli\bin but when i run npm root -g it shows current directory path, not the path i set Nodejs is install to C:\Program Files\nodejs 回答1: I found a way to set the global path to roaming. Go to: C:\Users\YOURNAME\.npmrc and locate NPMRC . Edit the file to: C:\Users

Angular 5 intercept - requests are duplicated

狂风中的少年 提交于 2019-12-13 03:56:04
问题 I am using an interceptor with HttpInterceptor in angular 5 and I have a problem with rxjs where all my http requests are duplicated. import { Router } from '@angular/router'; import { Injectable, ApplicationRef } from '@angular/core'; import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpResponse } from '@angular/common/http'; import { Observable } from 'rxjs/Rx'; import 'rxjs/add/observable/throw'; import 'rxjs/add/operator/catch'; import 'rxjs/add/observable/empty'; import {

How to drag and reorder content in angular

折月煮酒 提交于 2019-12-13 03:54:42
问题 I have 5 different content. I want to drag and reorder it in the same row.. How can I do this in angular 2,4,5 or 6. If anybody know please help me to do this. stackblitz 回答1: This library containe all drag and drop future ng2-dragula,and this the demo stackblitz example 回答2: I use this package, it is useful, good theme(especially with Material) here the package here Demo 来源: https://stackoverflow.com/questions/51360466/how-to-drag-and-reorder-content-in-angular

cannot resolve symbol NgxPaginationModule

有些话、适合烂在心里 提交于 2019-12-13 03:46:44
问题 I am trying to use NgxPaginationModule in my Angular5 project cannot resolve symbol NgxPaginationModule , i followed all step as documented app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import { GlobalModule } from './global/global.module'; import { ProtectedModule} from './protetcted/protect-module.component'; import { AppRoutingModule } from './app.routing.module'; import

Performance between calling function on ngStyle vs directive

混江龙づ霸主 提交于 2019-12-13 03:45:54
问题 What is the main difference of <p [ngStyle]="getStyle()"> // getStyle returns a string like "color:blue" and some other attributes to <p appStyle [status]="myStatus"> //directive get myStatus as a input and calculate the style of the tag The application that I'm doing maintenance call these functions getStyle on ngStyle a lot (probably 5k times). I am currently changing the style calculation to directives, because I think its cleaner. But I don't know how much it will affect performance. How

Angular 5 and PHP can't use the POST method to send a value to server scripts

人盡茶涼 提交于 2019-12-13 03:44:00
问题 I am having a problem using post method in Angular 5 and PHP. I have this method from a .ts class: addPartners(partnerName) { let headers = new Headers(); headers.append('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); this.name = JSON.stringify(partnerName) console.log("hi "+ this.name) return this.http.post('http://aff.local/addPartner.php', this.name, { observe: 'response', responseType: 'json' }).pipe(map( res=>{ console.log(res) } )) } And I will call it on (click)

Angular 4+ overwrite child component's style

僤鯓⒐⒋嵵緔 提交于 2019-12-13 03:36:21
问题 I want to force parent comp to change child comp's style without the !important modifier. My question is.. is there any way to do that? (I am beginner to angular may not the best solution.) Here is a minimal example about the 2 comps. Child has a simple div in template :) parent.component.scss: ::ng-deep .child-div{ background-color: red; } childe.component.scss: .child-div{ width: 100rem; height: 100rem; background-color: $pink; color: $blue; line-height: 100rem; text-align: center; margin