angular6

How to give session idle timeout in angular 6?

笑着哭i 提交于 2019-12-20 14:12:03
问题 We are maintaining a session based on user role. We want to implement timeout functionality when the session is idle for 5 min. We are using @ng-idle/core npm module to do that. My Service file: import { ActivatedRouteSnapshot } from '@angular/router'; import { RouterStateSnapshot } from '@angular/router'; import {Idle, DEFAULT_INTERRUPTSOURCES, EventTargetInterruptSource} from '@ng-idle/core'; @Injectable() export class LoginActService implements CanActivate { constructor(private authService

How to give session idle timeout in angular 6?

北慕城南 提交于 2019-12-20 14:11:29
问题 We are maintaining a session based on user role. We want to implement timeout functionality when the session is idle for 5 min. We are using @ng-idle/core npm module to do that. My Service file: import { ActivatedRouteSnapshot } from '@angular/router'; import { RouterStateSnapshot } from '@angular/router'; import {Idle, DEFAULT_INTERRUPTSOURCES, EventTargetInterruptSource} from '@ng-idle/core'; @Injectable() export class LoginActService implements CanActivate { constructor(private authService

How to add external js file in angular 6 library

送分小仙女□ 提交于 2019-12-20 10:34:19
问题 I am creating an angular library (version 6) which is based on angular material for which I need to include the hammer js library. I know that in angular 6 we can add the external js library in the angular.json under the project's configuration. But this does not work in case of above library. I tried to add the external library in the following way. "my-library": { "root": "projects/my-library", "sourceRoot": "projects/my-library/src", "projectType": "library", "architect": { "build": {

Angular 6 - Why use @ngrx/store rather than service injection

▼魔方 西西 提交于 2019-12-20 08:23:37
问题 I am recently learning Angular 6 with @ngrx/store while one of the tutorial is to use @ngrx/store for state management, however I don't understand the benefit of using @ngrx/store behind the scene. For example, for a simple login and signup action, previously by using the service(Let's call it AuthService) we might use it to call the backend api, store "userInfo" or "token" in the AuthService, redirect user to "HOME" page and we can inject AuthService in any component where we need to get the

How to wait till i get a response from backend spring boot api in angular 7

北战南征 提交于 2019-12-20 07:45:39
问题 I wanted to navigate from one route to another route with the result of http post method. But the navigation is happening without the response from http post. The response is getting later when i debugged the code How can i fix this ? is there any way to wait the execution till the response comes from backend ? when i click on a button, a function will execute and a http post call will happen then i need to pass the response from the post request to a new route Quiz.service.ts getResult

Change form elements using angular form

China☆狼群 提交于 2019-12-20 07:34:51
问题 I am making angular dynamic form with form-elements loaded through JSON.. The form element generation are working fine, but i am in the need of change of form elements based on options selected from dropdown.. JSON that generates form-elements jsonData: any = [ { "elementType": "textbox", "class": "col-12 col-md-4 col-sm-12", "key": "project_name", "label": "Project Name", "type": "text", "value": "", "required": false, "minlength": 3, "maxlength": 20, "order": 1 }, { "elementType": "dropdown

Change form elements using angular form

耗尽温柔 提交于 2019-12-20 07:34:47
问题 I am making angular dynamic form with form-elements loaded through JSON.. The form element generation are working fine, but i am in the need of change of form elements based on options selected from dropdown.. JSON that generates form-elements jsonData: any = [ { "elementType": "textbox", "class": "col-12 col-md-4 col-sm-12", "key": "project_name", "label": "Project Name", "type": "text", "value": "", "required": false, "minlength": 3, "maxlength": 20, "order": 1 }, { "elementType": "dropdown

What is the function of --poll flag in CLI

无人久伴 提交于 2019-12-20 06:28:43
问题 I was searching a solution for an issue which is in my angular project, ng serve --watch was not detecting changes in some of the files. And I got a solution which says use --poll=2000 It really worked. But there are no clear information available about the function of flag poll . 回答1: In cases where Angular CLI is running in a shared directory on linux VM on a windows host the webpack dev server isn't detecting file changes from the host environment. (ex: Whenever a docker dev environment is

ngForm simple example in angular 6 with select box

喜夏-厌秋 提交于 2019-12-20 02:35:44
问题 Angular 6 form validation simple example. With email validation and select box(drop down).ngForm simple example in angular 6 with select box 回答1: 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 }"

Angular 6 FormGroup.disable() method is not working with my template driven NgForm

白昼怎懂夜的黑 提交于 2019-12-20 00:23:51
问题 When I try to use the disable method on a formGroup in my Angular 6 app , I get this error in the browser console : TypeError: this.personForm.disable is not a function Although the method is mentioned in the documentation & it is even suggested by VS Code as in this snapshot. My code is here: // ... many parts skipped, the form here is template driven // but still personForm is a FormGroup , // I am trying to disable the whole FormGroup with all child elements @ViewChild('personForm')