angular6

To display selected list-item values in another component [closed]

空扰寡人 提交于 2020-01-06 05:27:07
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 10 months ago . I have 2 components called list (i,e Person list) and details (i,e Person details) which i am displaying like this: Here my requirements is: On selecting particular list-item for ex:Person 1, I want to display the Person 1 details on details component which present on the right side, something like this: How

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

HttpClient Interceptor forces request duplicates

邮差的信 提交于 2020-01-06 04:53:08
问题 I like to have a HttpInterceptor (Angular 6), which adds Authorization Headers but also handles 401 to redirect to login page. This is my code: import {Injectable} from '@angular/core'; import {HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http'; import {Observable} from 'rxjs'; import {Router} from '@angular/router'; @Injectable() export class JwtInterceptor implements HttpInterceptor { constructor(private router: Router) { } intercept(request

is that possible to send FormData along with Image file to web API from Angular 6 application

匆匆过客 提交于 2020-01-05 23:16:32
问题 Is it possible to pass the form data along with image file to web api from angular 6 application. app.component.ts onSelectFile(event) { if (event.target.files && event.target.files[0]) { this.imageToUpload = event.target.files[0]; const reader = new FileReader(); reader.onload = e => this.selectedImage = reader.result.toString(); this.fileName = event.target.files[0].name; reader.readAsDataURL(this.imageToUpload); } } createNewComitteeMember() { var mServiceObject = { ComitteeMemberName:

Angular.json scripts not loading

眉间皱痕 提交于 2020-01-05 11:17:05
问题 i am trying to use bootstrap navbar with the example from bootstrap docs, if i am loading it from angular.json the toggle hamburger is not working. if i am using there CDN links from bootstrap docs: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

Material autocomplete not displaying list on click

China☆狼群 提交于 2020-01-05 07:13:09
问题 I have a material autocomplete. I am making an ngrx call to pull the data. //parentcomponent.ts this.store.select(fromStore.getSearchFormStateMessageTypeListData).subscribe(msgTypeList => { if (msgTypeList.length > 0) { console.log('msgtypelist ='+msgTypeList) for (var i = 0; i < msgTypeList.length; i++) { this.messageTypeList.push(msgTypeList[i]); } } else { this.store.dispatch(new fromStore.GetGlobalSearchMessageTypeList({})); } }) //parentcomponent.html <mat-card style="margin: 1px;">

Angular sharing data to Components using service fails

谁说我不能喝 提交于 2020-01-05 05:54:10
问题 I'm having 2 services in my angular frontend, one for API calls and one for sharing data two different components. So the second service is using the API service. If I only use the API service and subscribe my Observables inside my component, everything works fine(view in xxx.component.html). So if I declare the two services as providers inside app.module and inject the API Service inside the sharing service, it won't work any more. Using debugger, I always get variable "tmp" not defined in

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

Cannot find control with unspecified name attribute in angular 6 form builder

懵懂的女人 提交于 2020-01-05 04:08:10
问题 I got this error message when trying to update the grid table with the HTML file. Here I have used static data for the table to display and imported from other component which displays the primeng table and I have added an update button with a function which redirects to another page for updating of data. The issue is seen in the first line in the HTML file i.e; [formGroup]="myvehicle" I have tried checking with a different form group name but still the issue is same. import { Component,

Angular6 catch timeout error

╄→尐↘猪︶ㄣ 提交于 2020-01-04 15:33:34
问题 with this code I can catch all the exceptions, except the when the server is anavailable. Do you have any idea about how should be handle ? return this.http.post<User>(this._appSetting.ebit.base_url "rested/login/login", JSON.stringify(params), httpOptions) .pipe(catchError(this.handleError)); 回答1: You can use the timeout() operator to catch a timeout. It's measured in milliseconds so 10000 would be 10 seconds. return this.http.post<User>(this._appSetting.ebit.base_url "rested/login/login",