Data Grid for Angular 2 [closed]

I found one example of ng2-table. https://github.com/valor-software/ng2-table Demo :- http://valor-software.com/ng2-table/ A recommended way to install ng2-table is through npm package manager using the following command: npm i ng2-table –save Below API used. import { Ng2TableModule } from ‘ng2-table/ng2-table’; or if you want to import specified plugins (Table component is required, the others are optional): import … Read more

submit vs ngSubmit in Angular 2

from this tutorial, https://blog.thoughtram.io/angular/2016/03/21/template-driven-forms-in-angular-2.html However, ngSubmit ensures that the form doesn’t submit when the handler code throws (which is the default behaviour of submit) and causes an actual http post request. Let’s use ngSubmit instead as this is the best practice:

Pass different context to ngIf

There are two very similar ways to solve this. I’ve created a stackblitz with the two solutions (tested with Angular 6.0.1 and the latest 6.1.8) for passing data to different templates based on a condition. version #1 <ng-container *ngTemplateOutlet=”showUser ? userTmpl : emptyTmpl; context: { $implicit: user }”> </ng-container> <ng-template #userTmpl let-user> … </ng-template> <ng-template … Read more

Angular material Error when mat-checkbox is imported

The error means that the form field cannot find a compatible material input inside of it. Do not use <mat-checkbox> inside <mat-form-field>. The following Angular Material components are designed to work inside a <mat-form-field>: <input matNativeControl> & <textarea matNativeControl> (version 7 & newer) <select matNativeControl> (version 7 & newer) <input matInput> & <textarea matInput> (version … Read more

What are practical scenarios of *ngTemplateOutlet directive?

Angular template outlets can be used to insert a common template in various sections of a view that are not generated by a loop or subject to a condition. For example, you can define a template for the logo of a company and insert it in several places in the page: <div> <ng-container *ngTemplateOutlet=”companyLogoTemplate”></ng-container> <h1>Company … Read more

Angular filter Observable array

it should be: getProjectByName(name: String) { return this.projects .map(projects => projects.filter(proj => proj.name === name)); } you misunderstood about filter operator. The operator using to filter data return from stream. Your stream return array of object, so you need filter array to get you needed value. The solution above will return an array after filtered, … Read more