angular5

Angular 5 - Can't bind to 'ngFormOptions' since it isn't a known property of 'form'

走远了吗. 提交于 2019-12-19 08:55:17
问题 We just recently updated our application Angular version to v5 and as part of new update Forms support ngFormOptions to configure the validations for form elements on certain events. Below is what we have done: <form class="example-form" autocomplete="off" [ngFormOptions]="{updateOn:'submit'}" [formGroup]="testform"> </form> But it's throwing below error Can't bind to 'ngFormOptions' since it isn't a known property of 'form' Below the dependencies for the application after update. package

Can't bind to 'ngOutletContext' since it isn't a known property of 'ng-template' [duplicate]

故事扮演 提交于 2019-12-19 05:22:48
问题 This question already has answers here : Can't get ngTemplateOutlet to work (3 answers) Closed 2 years ago . Below worked fine in Angular 4 <ng-container *ngFor="let user of list_users"> <div *ngIf="currentUser.username !== user.username"> <div class="card"> bla bla </div> </div> </ng-container> Angular 5 is whining about this error: Can't bind to 'ngOutletContext' since it isn't a known property of 'ng-template'. 1. If 'ngOutletContext' is an Angular directive, then add 'CommonModule' to the

Caching of index.html in Angular Service worker

陌路散爱 提交于 2019-12-19 02:30:10
问题 Everytime I make any change to the index.html with my angular project, Serviceworker never gets updated and always serves the old cached version on index.html. How do I fix this (Also, there is no caching at the server end as well as browser) Here is my ngsw-config file { "index": "/index.html", "assetGroups": [{ "name": "app", "installMode": "prefetch", "resources": { "files": [ "/favicon.ico", "/index.html", "/manifest.json" ], "versionedFiles": [ "/*.bundle.css", "/*.bundle.js", "/*.chunk

Angular 5: remove route history

烈酒焚心 提交于 2019-12-18 18:59:46
问题 In my app I have a category page that has links to a various product list pages. If it turns out that when you get to a product list page there is only one product then it automatically navigates to that product detail page. What I want is to remove the product list page route in the history so that when the user is on the product detail page and hits the back button they will go to the category page and not the product list page because that will just redirect them back to the detail page.

'mat-toolbar' is not a known element - Angular 5

旧时模样 提交于 2019-12-18 18:51:23
问题 I have created a new project, and I am trying to add angular-material . I have created material.module.ts in my app folder: import { NgModule } from '@angular/core'; import { MatButtonModule, MatMenuModule, MatIconModule, MatCardModule, MatSidenavModule, MatFormFieldModule, MatInputModule, MatTooltipModule, MatToolbarModule } from '@angular/material'; @NgModule({ imports: [ MatButtonModule, MatMenuModule, MatIconModule, MatCardModule, MatSidenavModule, MatFormFieldModule, MatInputModule,

Open pdf from bytes array in angular 5

夙愿已清 提交于 2019-12-18 16:53:16
问题 I was following the below links for displaying pdf page in new tab in my angular 5 application. But unable to achieve the result. I am consuming the bytes array from spring controller api. PDF Blob is not showing content, Angular 2 PDF Blob - Pop up window not showing content Angular2 Displaying PDF I tried the below options but none of them is working. Trial 1 Consumed the response as json component.ts clickEvent(){ this.service.getPDF().subscribe((response)=>{ let file = new Blob([response

Type 'ElementRef' is not generic

醉酒当歌 提交于 2019-12-18 14:53:40
问题 I am working with a project using Material Component in Angular 5. I did update my Visual code but I don't know what happened. I am facing an issue "Type 'ElementRef' is not generic." I have been stuck on this issue since morning. Error in this line _inputElement: ElementRef<HTMLInputElement>; constructor(toggleGroup: MatButtonToggleGroup, _changeDetectorRef: ChangeDetectorRef, _elementRef: ElementRef<HTMLInputElement>, _focusMonitor: FocusMonitor); 回答1: I think the problem could be if your

Save FormData with File Upload in Angular 5

我只是一个虾纸丫 提交于 2019-12-18 13:37:39
问题 I am trying to save files along with FormData in Angular 5. I can get the single file, but have no idea how to get all the files uploaded. I have three image files and input fields, tried searching examples. But only got for multiple file uploads. I want to upload each and every single file from this form. Below is my code : import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { Location } from '@angular/common'; import { ActivatedRoute } from '@angular/router'; import

Form custom fields validation angular 2

て烟熏妆下的殇ゞ 提交于 2019-12-18 09:49:47
问题 I try form template driven validation for select and radio buttons and checkboxes but not working these custom fields. How we can validate these fields.I do not know how to do it.Please anyone help me to resolve this issue. <!--Country--> <div class="form-group"> <label for="country">Country</label> <app-selectbox name="country" [(inputModel)]="model.country" [(ngModel)]="model.country" #country="ngModel" required> <option [ngValue]="null">---Select---</option> <option *ngFor="let item of

mat-table can't bind dataSource

本秂侑毒 提交于 2019-12-18 09:38:50
问题 I am trying to use angular material table MatTableModule , but when passing the data to the [dataSource] input I am getting the Can't bind to 'dataSource' since it isn't a known property of 'table'. error. I have already imported the MatTableModule and as pointed at GitHub issue #5577 also imported CdkTableModule but still no luck. Any ideas? 回答1: The problem was that the material angular version I'm using is v5.2.4, so the template should be <mat-table #table [dataSource]="dataSource"></mat