angular7

Adding formControlName makes the default value disappear in my form's dropdown in Angular

被刻印的时光 ゝ 提交于 2019-12-24 10:48:45
问题 I have this select element and I'm seeing something odd, when I add the formControlName to the tag the initial value "month" doesn't display, but if I remove it, it displays but doesn't validate correctly because it can't bind. Here is my form and the html this.registerForm = this.fb.group({ gender: ['male'], email: ['', [Validators.required, Validators.email]], username: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(10)]], month: ['', Validators.required], day: [''

Refreshing datatables.net table data in Angular 7 keeps a copy of the old data from table's first loading

做~自己de王妃 提交于 2019-12-24 08:41:02
问题 I'm trying to make a live reporting from a REST API request using the datatables.net library in Angular 7. If I make a data update into the database, the data in the table is updated. However, If I touch the table (i.e. reorder, search for something, change the page, etc), on data reloading (which occurs every 5 seconds), in the table is added the data from the first load of the table. If I touch the table again, the updated data disappears, and only the old data remains, until the next data

How do I create an HtmlElement Reference in an Angular component?

懵懂的女人 提交于 2019-12-24 08:04:10
问题 I have a component MyNodeComponent that takes a target HTML element as part of the input object in my Angular 7.2.15 : @Component({ selector: 'my-node', templateUrl: './my-node.component.html' }) export class MyNodeComponent implements OnInit, OnChanges, AfterViewInit { @Input() inputObject: [{target: HTMLElement, desc: string}]; ... } The problem is I am not sure how to send an HTML DOM node to target in a dynamic fashion. Especially as there could be multiple instances of MyNode on a page

Angular7 ControlValueAccesor as FormArray

吃可爱长大的小学妹 提交于 2019-12-24 04:13:41
问题 I need to develop a reusable list component, which returns a list of objects, a plain list of objects, those should be a assigned to key in a formGroup object value. Is there a way to do a custom control in Angular which is a list? Here is what I tried and what I intent to do, hope the code is self explanatory. // PARENT COMPONENT <div [formGroup]="form" [ngSubmit]="submit()"> <custom-list formControlName="profiles"></custom-list> <custom-list formControlName="groups"></custom-list> <custom

BrowserModule has already been loaded

拈花ヽ惹草 提交于 2019-12-24 04:01:13
问题 This is my code: import { CommonModule } from '@angular/common'; import { HttpClientModule } from '@angular/common/http'; import { NgModule } from '@angular/core'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { LanguageTranslationModule } from './shared/modules/language-translation/language-translation.module' import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { AuthGuard } from './shared';

Angular 7 - Trying to create a preview of an audio file before upload

别说谁变了你拦得住时间么 提交于 2019-12-24 03:22:49
问题 My desired result is to create a preview of an audio file before it is uploaded to the server. However after file input, nothing happens. A file is not dynamically added to the aduio tag, nor do I receive any errors. The console shows that the file was loaded. Any help would be greatly appreciated! My component html has~ <audio controls #figAudio> <source [src]="audSrc" type="audio/ogg"> <source [src]="audSrc" type="audio/mpeg"> <source [src]="audSrc" type="audio/wav"> </audio> <input type=

Run ng build with custom configurations

可紊 提交于 2019-12-24 00:25:29
问题 I have Angular project which I would like to deploy on Apache server. I use ng build but I would like to custom address and endpoint for backend. proxy.conf.json: { "/api/*": { "target": "http://localhost:8080", "secure": false, "logLevel": "debug", "changeOrigin": true } } This configuration is not applied at all. How I can set it properly in order to change configurations? Environment ts file: import {environment as prod} from './environment.prod'; export const environment = Object.assign

Angular 7, svg and sass how to set relative path

江枫思渺然 提交于 2019-12-23 22:36:34
问题 Hi we are currently trying to update a Angular 6 application to Angular 7. But we have one issue. In Angular 6 building using "ng build". Inlines the svg in the css file like this: background: url('data:image/svg+xml,<%3Fxml version%3D"1.0" encoding%3D"utf-8"%3F>...'); } But after upgarding to Angular 7 the svg is moved to the dest folder and the path is set like this: background-image: url('zoom-in.svg'); Other assets are not set to this. Our solution has an other structure so we need to

Angular 6/7 by default uses Eager/Lazy loading? [closed]

孤者浪人 提交于 2019-12-23 19:29:53
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . As the title says, do we need to manually implement Lazy Loading for the modules or does Angular 6/7 does it by default? 回答1: Angular by default uses eager loading unless specified otherwise. To implement Lazy Loading, following things need to be specified to the RouterModule : A

No NgModule metadata found for 'AppModule' after upgrade from Angular 5 to Angular 7

吃可爱长大的小学妹 提交于 2019-12-23 15:21:50
问题 Our dev team recently updated an Angular 5 project to Angular 7. I've downloaded the repo and I'm trying to build the source, however when I run the ng build command I get a ERROR in No NgModule metadata found for 'AppModule' . If I run the ng --version command it shows the following: Angular CLI: 7.3.6 Node: 11.10.0 OS: win32 x64 Angular: 7.2.10 The app.module.ts file is: import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import {