angular6

Angular Material component not working: 'mat-option' is not a known element

我的梦境 提交于 2019-12-01 21:08:56
I am trying to add angular material component. but the component did not work properly. that error said Uncaught Error: Template parse errors: 'mat-option' is not a known element: // ... I think the error comes from app.module.ts : import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { SidebarComponent } from './sidebar/sidebar.component'; import { PostsComponent } from './posts/posts.component'; import { UsersComponent } from './users

ngForm simple example in angular 6 with select box

情到浓时终转凉″ 提交于 2019-12-01 20:46:06
Angular 6 form validation simple example. With email validation and select box(drop down).ngForm simple example in angular 6 with select box Use ngForm. Import it your component.module.ts(module file) import { FormsModule } from '@angular/forms'; Add it your component template <form role="form" (ngSubmit)="f.form.valid && onSubmit()" #f="ngForm" novalidate> <select name="name_id" [(ngModel)]="model.name_id" #name_id="ngModel" [ngClass]="{ 'is-invalid': f.submitted && name_id.invalid }" required> <option value="" disabled selected>Select Name</option> <option *ngFor="let name of allnames"

No config found or get/set have been deprecated in angular 6

大城市里の小女人 提交于 2019-12-01 19:41:24
ng config --global defaults.styleExt=scss Error: config not found ng set --global defaults.styleExt=scss Error: get/set have been deprecated in favor of the config command. Installed Packages versions ngular CLI: 6.0.3 Node: 8.11.1 Angular: 6.0.2 @angular/cli 6.0.3 @ngtools/webpack 6.0.3 webpack 4.8.3 update The following command gave me an error in the image ng config schematics.@schematics/angular:component '{ styleext: "scss"}' ng set --global defaults.styleExt=scss is deprecated since ng6. You should use: ng config schematics.@schematics/angular:component '{ styleext: "scss"}' If you want

Select All mat option and deselect All

余生长醉 提交于 2019-12-01 16:11:04
问题 I have scenario as below: I want to achieve is: When user click on All then all options shall be selected and when user click All again then all options shall be deselcted. If All option is checked and user click any other checkbox than All then All and clicked checkbox shall be deselected. When user selects 4 options one by one then All shall be selected. HTML file <mat-select placeholder="User Type" formControlName="UserType" multiple> <mat-option *ngFor="let filters of userTypeFilters"

Angular 6 ng lint combineLatest is deprecated

廉价感情. 提交于 2019-12-01 15:45:30
I recently updated from Angular 5 to Angular 6. I'm getting this warning combineLatest is deprecated: resultSelector no longer supported, pipe to map instead . Rxjs is version 6.1.0, tslint is 5.10.0, Angular CLI is 6.0.0 and Typescript 2.7.2. I'm using it like this: const a$ = combineLatest( this.aStore.select(b.getAuth), this.cStore.select(b.getUrl), (auth, url) => ({auth, url}), ); I've tried it also like this: empty().pipe( combineLatest(...), ... ) But this gives me: combineLatest is deprecated: Deprecated in favor of static combineLatest and empty is also deprecated in favor of its

Angular 6 : where getting error module “rxjs/add/operator/map” and another error 'map' does not exist on type 'Observable<Response>'

孤者浪人 提交于 2019-12-01 14:52:43
I am using Angular 6 where I am getting two errors - ERROR in ./src/app/app/img/img.service.ts Module not found: Error: Can't resolve 'rxjs/add/operator/map' in '/Users/user/Projects/A4/imageSearch/src/app/app/img' ERROR in src/app/app/img/img.service.ts(21,9): error TS2339: Property 'map' does not exist on type 'Observable'. I faced similar problem with rxjs map operator. Currently I'm using Angular 6. To know which version you are using: ng --version or ng -v If you are also using angular 6, then please checkout https://www.academind.com/learn/javascript/rxjs-6-what-changed/ Different

Angular 6 ng lint combineLatest is deprecated

99封情书 提交于 2019-12-01 13:46:12
问题 I recently updated from Angular 5 to Angular 6. I'm getting this warning combineLatest is deprecated: resultSelector no longer supported, pipe to map instead . Rxjs is version 6.1.0, tslint is 5.10.0, Angular CLI is 6.0.0 and Typescript 2.7.2. I'm using it like this: const a$ = combineLatest( this.aStore.select(b.getAuth), this.cStore.select(b.getUrl), (auth, url) => ({auth, url}), ); I've tried it also like this: empty().pipe( combineLatest(...), ... ) But this gives me: combineLatest is

ASP.Net Core 2.1 Angular SSR/Universal returning Http Status Code 404

陌路散爱 提交于 2019-12-01 13:16:33
问题 With SpaPrerenderingExtensions available in ASP.Net core 2.0 JavaScriptServices , it seems that we can return the HTTP Status Code from the Angular (SSR) App which SpaPrerenderingExtensions will use to return the HTTP Status Code to the client. If you take a look at below method in SpaPrerenderingExtensions private static async Task ServePrerenderResult(HttpContext context, RenderToStringResult renderResult) Complete code of SpaPrerenderingExtensions is available here: https://github.com

Angular 6 cannot automatically select/bind dropdown list value from supplied object

狂风中的少年 提交于 2019-12-01 12:26:19
I get a country object from a service and bind it to a form that has a dropdown list of countries. The country doesn't appear selected after retrieving it from the service but all the other data is shown OK including a string gender field which is bound to a dropdown list. I can manually select the country from the list though. How can I automatically show the country as selected? personal-details.component.html <form [formGroup]="form" (submit)="doSave(form.values)"> <mat-card class="main-card"> <mat-card-content> <p>Personal Details</p> <mat-form-field class="full-width-input"> <input

Pug support for Angular 2 / Angular 4 / Angular 6 / Angular cli / Angular cli 6 (without custom WebPack config)

喜欢而已 提交于 2019-12-01 12:19:17
How to install correctly PUG / JADE to Angular 2 or above So that while working and AOT and JiT Worked Unit and Integration Tests and do not suffer much when creating each new component Никита Середа I saw many solutions, some of them: in each component was added something like "require!pug-loader()some.component.pug" Get away from using angular-cli and create magic around webpack Use other servers (who know how to work with the Pug / Jade) Before running the build, convert all the pug files to html I think that they will refuse the server justified for angular - it's not true, run some pre