angular7

How to set css margin for my ng-content all child html elements?

你。 提交于 2020-01-06 05:18:04
问题 I need margin top,bottom,left,right of my all html components inside the ng-content.How to write the css for that? I tried but not working.Please help me to resolve this issue. app.component.html: <div class="wrapper"><ng-content></ng-content></div> app.component.css: .wrapper{ position:fixed; background-color:#ccc; height:60px; padding:10px; bottom:0; left:0; width:100%; } .wrapper:: ng-deep <ng-content>{ margin:5px 8px 4px 2px; padding:0; text-align:center; } 回答1: app.component.html <div

Current route list not updated if already stay in same route in Angular 7?

天涯浪子 提交于 2020-01-06 04:40:29
问题 I have two component header and searList component. Case 1: Inside header component we have call API for get result after result is get and click search all result link.after click user is redirect to searchList component in which we have showing list of result. Case 2: Now user is stay on searList component, now again user is search another user and we get different result now.in such scenario user is not redirect on searhList component because we are already stay on searhList component.

How to receive file upload from Angular Reactive Form?

岁酱吖の 提交于 2020-01-05 05:38:26
问题 I have module to upload file in Angular 7 Reactive Forms ( I need reactive form because I need to upload files and some other information together) I follow this article: https://medium.com/@amcdnl/file-uploads-with-angular-reactive-forms-960fd0b34cb5 the code as follow: https://pastebin.com/qsbPiJEX onFileChange(event) { const reader = new FileReader(); if(event.target.files && event.target.files.length) { const [file] = event.target.files; reader.readAsDataURL(file); reader.onload = () => {

Import and Export Core Module and Shared Module

大兔子大兔子 提交于 2020-01-05 05:31:24
问题 I'm having a difficulty in determining on what should i "import" and "export" in my core modules and shared modules. For instance, in my shared module, i imported and exported CommonModule while only exported the ReactiveFormsModule. In my core module, i imported modules and exported components only. I'm wondering what should i "import" and "export" in core and shared module? I've read other examples here in stackoverflow and the docs and I'm still confuse. Please check my structure/codes

Error after updating to angular 7. Argument of type 'string | ArrayBuffer' is not assignable to parameter of type 'string'

别说谁变了你拦得住时间么 提交于 2020-01-04 09:07:05
问题 I upgraded my project from angular 6 to angular 7. I have a file upload component in my project. It gives a compiler error after the upgrade. onUpload() { const fileReader = new FileReader(); fileReader.onload = () => this.uploadFile(fileReader.result); fileReader.readAsText(this.fileToUpload); } uploadFile(fileContent: string) { //upload } In above code, this.uploadFile(fileReader.result) gives following error. error TS2345: Argument of type 'string | ArrayBuffer' is not assignable to

How to use Ngx-pagination on table in angular 7

眉间皱痕 提交于 2020-01-04 07:28:10
问题 Hi I have a list like, [{…}, {…}, {…}] 0: {name: "Manu", age: "21", hobbies: Array(4)} 1: {name: "Anu", age: "20", hobbies: Array(3)} 2: {name: "nandu", age: "22", hobbies: Array(5)} I need to show this on a table.So i am doing the code below <table id='studTable'> <thead> <tr> <th style="text-align: center">Student Name </th> <th style="text-align: center">Age</th> <th style="text-align: center">Hobbies</th> </tr> </thead> <tbody> <tr *ngFor="let student of students | paginate: {

How to use Ngx-pagination on table in angular 7

笑着哭i 提交于 2020-01-04 07:27:16
问题 Hi I have a list like, [{…}, {…}, {…}] 0: {name: "Manu", age: "21", hobbies: Array(4)} 1: {name: "Anu", age: "20", hobbies: Array(3)} 2: {name: "nandu", age: "22", hobbies: Array(5)} I need to show this on a table.So i am doing the code below <table id='studTable'> <thead> <tr> <th style="text-align: center">Student Name </th> <th style="text-align: center">Age</th> <th style="text-align: center">Hobbies</th> </tr> </thead> <tbody> <tr *ngFor="let student of students | paginate: {

Angular7: unable to set {responseType: 'text'}

心已入冬 提交于 2020-01-04 03:33:36
问题 Scenario : Upon an API call from Angular7, i am calling Node (via express) and returning chunked data of type string - I want to capture this string data and display it as string Server-side: From Node backend, the data is being sent is 'text' and not json... the data is sent via multiple res.write('some strings') statements client-side in Angular: I want an observable to process this data... when i don't mention any responseType [return this.http.get(this.streamURL );]... i get error:

Angular7: unable to set {responseType: 'text'}

自作多情 提交于 2020-01-04 03:33:12
问题 Scenario : Upon an API call from Angular7, i am calling Node (via express) and returning chunked data of type string - I want to capture this string data and display it as string Server-side: From Node backend, the data is being sent is 'text' and not json... the data is sent via multiple res.write('some strings') statements client-side in Angular: I want an observable to process this data... when i don't mention any responseType [return this.http.get(this.streamURL );]... i get error:

How to handle nested HTTP requests in Angular 7?

本小妞迷上赌 提交于 2020-01-03 06:08:31
问题 I have a generic service for get data from server. When response received, I'm using a mapper function to map pure JSON data to required model. For some class type in mapper function, I need to get some additional data from server. How can I forcing mapper function wait for second request? This is my get function: getChildren(params: ITreeQueryParams): Observable<Optional<T[]>> { params.id = isPresent(params.id) ? params.id : 0; params.parentId = isPresent(params.parentId) ? params.parentId :