angular5

Ng2-smart-table : Use datepicker format in the field

三世轮回 提交于 2020-01-25 05:09:30
问题 Is there any probability that I can use datepicker format in the ng2-smart-table. jobSettings2: object = { columns: [ { displayName: "Job ID", valueAs: "JobID", align: "left", columnWidth: "", type: "text", required: true }, <ng2-smart-table id="tableID" class="table table-hover" [settings]="jobSettings" [source]="jobSource" (userRowSelect)="selectjobs($event)"></ng2-smart-table> 回答1: For data you can use npm install --save ng-pick-datetime , This provide many features to play with date. If

Insert dynamically create component after clicked row

寵の児 提交于 2020-01-24 17:37:26
问题 I am working on solution in which i want to append dynamically created component after clicked row I have table consist rows with action button on click of which i will call angular function and load component after that row. Here is table code <div class="row" *ngFor="let rData of reportData; let i = index;" > <div class="col" > <button class="btn btn-sm" (click)="loadChildComponent()">+</button> </div> <div class="col">Name</div> <div class="col">Description</div> <ng-template #dynamic></ng

Angular 5: Search with Async Pipe - show loading indicator

孤人 提交于 2020-01-24 01:01:07
问题 Im am implementing a search-field with async in Anglur 5. When the user begins typing in the search-box, the loading-indicator should show up. And when the results have arrived, the indicator should be hidden. I tried this approach, but then loading indicator is visible, even if the user has not typed anything. So what is the best way to implement this? My Template: <mdl-textfield #searchBox (keyup)="search(searchBox.value)" type="text" placeholder="Nach Kurs, Beteuer, Studiengruppe suchen...

How to short path to file in Angular?

早过忘川 提交于 2020-01-24 00:40:11
问题 In some CSS files I have import: @import "../../../theme.scss" @import "../../theme.scss" @import "../../../../../../theme.scss" @import "../theme.scss" How to use relative path as absolute path everywhere for all cases: @import "theme.scss" My full angulr.json code is: "reon-core": { "projectType": "library", "root": "projects/reon-core", "sourceRoot": "projects/reon-core/src", "prefix": "lib", "architect": { "build": { "builder": "@angular-devkit/build-ng-packagr:build", "options": {

changing css style dynamically from component in Angular 5

…衆ロ難τιáo~ 提交于 2020-01-23 17:03:51
问题 I am using materialized range: <div class="range-field col s6"> <input type="range" id="test5" min="0" max="100" #ranger (input)="yourMethod(ranger.value)"/> </div> This input creates in HTML span tag with class thumb, how could I change the color dynamically by changing the range? Is it possible to define in css .thumb {background-color: somevariable}, and change it from the component? 回答1: You can dynamically set the color in html through a variable defined in the component. <p [style.color

How to trigger Material2 <mat-error> to be displayed on input-change

梦想与她 提交于 2020-01-23 00:49:05
问题 Given the example at https://material.angular.io/components/form-field/overview <div class="example-container"> <mat-form-field> <input matInput placeholder="Enter your email" [formControl]="email" required> <mat-error *ngIf="email.invalid">{{getErrorMessage()}}</mat-error> </mat-form-field> </div> import {Component} from '@angular/core'; import {FormControl, Validators} from '@angular/forms'; /** @title Form field with error messages */ @Component({ selector: 'form-field-error-example',

Angular - Submit a form programmatically

混江龙づ霸主 提交于 2020-01-22 17:32:11
问题 Angular - Submit a form programmatically. I have a form group on the HTML and I want the component to submit the form's action with an email field in a post method. Instead of using a normal submit button. Below's testMethod gets called from another button. In this method, I want to post the testForm . It has to be posted old school way as it needs an action. This is my HTML: <form [formGroup]="testGroup" [action]='actionLink' method='POST' #testForm> <input name='Email' type='hidden' [value]

How to enable only specific dates in Angular 5?

坚强是说给别人听的谎言 提交于 2020-01-21 19:50:25
问题 I have set of dates and I want to enable only those dates in <mat-datepicker> . "ListOfDates": [ { "startDate": "2018-01-01T08:00:00" }, { "startDate": "2018-01-02T08:00:00" }, { "startDate": "2018-01-03T09:00:00", }] This is my html code: <mat-form-field> <input matInput [matDatepicker]="picker" [matDatepickerFilter]="dateFilter" placeholder="Choose a date"> <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle> <mat-datepicker #picker></mat-datepicker> </mat-form-field> In

Angular 5 HttpInterceptor and sending Authorization Token in header

﹥>﹥吖頭↗ 提交于 2020-01-21 08:53:25
问题 My flow is login page -> home page. Login page has no token, after logging in, server provides token and user is redirected to home page. Home page sends the token to server, token is verified, server sends back data to display on front end. Problem: HttpInterceptor firing on login request Cannot read property 'token' of null . I would like to have the interceptor somehow ignore the login api request and only intercept on subsequent calls if token exists. 回答1: hello you can a key value in

Angular get row data present just below the Row that has been edited

自作多情 提交于 2020-01-17 15:49:11
问题 Angular using p-table for displaying table after getting row data from service. Two columns viz - Date, CashValue are there Now after editing CashValue column, how can i get CashValue of the row just below the row that has been edited. <input> type="text" [(ngModel)]="rowValues.cashValue" (ngModelChange)="valueChange(rowValues.cashValue)" /> For example below is the table Date Cashvalue 21-Dec-2019 8000 14-Nov-2019 7000 8-Oct-2019 6000 5-Sep-2019 5000 Now on click of save after editing 6000