angular6

Angular 6 router - replace some of the parameters of the current route

坚强是说给别人听的谎言 提交于 2019-12-11 08:07:26
问题 In my Angular 6 solution, the urls have this structure: /{language}/{app_section}/{object_id}/{view}?queryparams... A language selector component is shared by all sections of the application, and is included in the template of one of the parent routes so that it appears in all the children routes. When a user selects a new language, the component should replace only the {language} segment of the current route, leaving everything else unchanged, and navigate to the new route. It seems it

Authorization header not sent with http request angular 6 with OPTIONS method

自闭症网瘾萝莉.ら 提交于 2019-12-11 08:06:27
问题 I am getting 401 error while sending post request using the angular code, when I inspected network request I found out that the headers are not being sent along the post request, please see the image: auth.service.ts login(username: string, password: string) { let httpHeaders = new HttpHeaders({ 'Authorization': 'Basic bXktdHJ1c3RlZC1jbGllbnQ6c2VjcmV0', 'Content-Type': 'application/json' }); let options = { headers: httpHeaders }; this.http.post( 'http://localhost:8080

How to save data as Firestore Timestamp object in Angular

不问归期 提交于 2019-12-11 08:05:27
问题 Just want to save Date as timestamp in Firestore database but it's storing timestamp as number: save() { const data = this.transactionForm.value; data.type = data.type == 'true' || data.type == true ? true : false; data.updated = firebase.firestore.FieldValue.serverTimestamp(); // Date string to timestamp data.date = new Date(data.date.split("-").reverse().join("-")).getTime(); let id = data.id; this.transCollection.doc(id).update(data); } 回答1: unixToTimestamp() { const date = new Date();

Need to integrate mxGraph with Angular 6

99封情书 提交于 2019-12-11 08:01:30
问题 I need to implement a gantt chart and think mxGraph Gantt could be the ideal solution. The only problem is with the integration of it in the application. Has anyone tried integrating and implementing it. If so , then please provide some directions/instructions on how to use it. https://github.com/jgraph/mxgraph/ 回答1: Here is Complete Solution: Few details about different mxGraph Repos: Repo-1: https://github.com/jgraph/mxgraph This is an official release repo of mxGraph. With npm issues. Repo

Disable a field in angular reactive form

爱⌒轻易说出口 提交于 2019-12-11 07:53:15
问题 In my angular 6 application, i am making a reactive form which has, Html <form [formGroup]="form"> <h2>Click the add button below</h2> <button (click)="addCreds()">Add</button> <div formArrayName="credentials" > <div *ngFor="let creds of form.get('credentials').controls; let i = index" [formGroupName]="i" style="display: flex"> <select formControlName="action"> <option *ngFor="let option of options" value="{{option.key}}"> {{option.value}} </option> </select> <input placeholder="Name"

Cannot get synchronization from inside subscribe to outside subscribe using localStorage or sessionStorage

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 07:49:16
问题 I have this mapping: User *----------------------------1 Role From the list of users, I go to consult one user from this list. To get some informations about that selected user, I need to use localSorage to get an object from inside subscribe to outside subscribe . Bellow is the method: this.userService.getAllRolesOfActualUser(user.id).subscribe(listRoles => { let roles:Array<Role> = []; if (listRoles) { listRoles.forEach((role) => { roles.push(new Role(role.id, role.name, role.selected)); })

Angular 6 ERROR in Couldn't resolve original symbol for ./src/util/decorators from …/node_modules/@angular/core/core.d.ts

不打扰是莪最后的温柔 提交于 2019-12-11 07:47:53
问题 I try to run the following to build my project for production and receive the error as stated in the subject: ng build --prod When I look in the core.d.ts file, it cannot find the following: "./src/change_detection/differs/default_iterable_differ"; "./src/profile/profile"; "./src/util/decorators"; The following is the entire file: /** * Generated bundle index. Do not edit. */ export * from "./index"; export { APPLICATION_MODULE_PROVIDERS as ɵangular_packages_core_core_l,

Get the default value of select radio Angular 6

放肆的年华 提交于 2019-12-11 07:46:12
问题 I have this mapping User *------------------------1 Profession. I'd like to modify one user. So I select one from list-users.component.html , I'll be redirected to modify-user.component.html . Bellow are the required files: modify-user.component.html <form [formGroup]="editForm" (ngSubmit)="onSubmit()"> <div class="form-group"> <label for="name">Name</label> <input type="text" formControlName="name" placeholder="Name" name="name" class="form-control" id="name"> </div> <div *ngFor='let pro of

angular does not find an uploaded image

白昼怎懂夜的黑 提交于 2019-12-11 06:55:30
问题 The scenario is simple. Use a form to upload an image and if it is successfully uploaded, refresh a photogallery. I use angular6 and ng-carousel. All the system is locally set in my windows 10 laptop. The form gets uploaded, the text data are saved on the database and the image is saved in a file in node 8.11.1. I save the image in the src/assets/images . I can see the changes and I get no errors while uploading. But, after the upload, I try to use the URL of the new image to add it as the

Hide other elements in list

最后都变了- 提交于 2019-12-11 06:48:19
问题 I have the below code: <li *ngFor="let item of Array let i = index"> <span> <label (dblclick)="editTag($event,i)"> {{item.tag}} </label> <input type="text" #tagInput /> </span> </li> The code is in a for loop. When I click on a label, all labels should be hidden and the input should be visible. Currently, when I click on each label, the other remain open. How do I hide the other span when clicking on any item? I have below code in .ts @ViewChild('tagInput') tagNameTextInput: ElementRef;