angular8

Angular 8: Grandparent Component detect when User Focus out of grandchild Component Textbox

社会主义新天地 提交于 2020-01-25 10:13:33
问题 I have a Nested Grantparent Smart Component, Parent Component with a Form, and a Grandchild Component with ZipCode textbox. How do I make it so, when user clicks out of the grandchild Component Textbox, Grandparent Component will know? Need to run business logic after user clicks out of textbox. Currently textbox is based off Material Angular wrapper. so Grand Smart Component Parent Form Textbox Parent Component has Formbuilder and many textboxes, sample below this.editAddressForm = this

Angular 8: Grandparent Component detect when User Focus out of grandchild Component Textbox

久未见 提交于 2020-01-25 10:13:21
问题 I have a Nested Grantparent Smart Component, Parent Component with a Form, and a Grandchild Component with ZipCode textbox. How do I make it so, when user clicks out of the grandchild Component Textbox, Grandparent Component will know? Need to run business logic after user clicks out of textbox. Currently textbox is based off Material Angular wrapper. so Grand Smart Component Parent Form Textbox Parent Component has Formbuilder and many textboxes, sample below this.editAddressForm = this

Update visibility of HTML element through directive

这一生的挚爱 提交于 2020-01-25 04:19:28
问题 I have a directive that shows or hides an HTML element StackBlitz : <div *authorize="'A'"> Visible when letter is A </div> And the Authorize directive is: @Directive({ selector: '[authorize]' }) export class AuthorizeDirective implements OnInit { letter: string; @Input() set authorize(letter: string) { this.letter = letter; } constructor(private element: ElementRef, private templateRef: TemplateRef<any>, private viewContainer: ViewContainerRef, private authorizationService:

Angular Use Child Component Form in Parent Component Nested Form

╄→尐↘猪︶ㄣ 提交于 2020-01-24 22:34:44
问题 Whats the best way to place a ChildComponent form into a Parent Component Form? We are using the latest Angular 8 in 2019. The following methods below after research do not work fully. Parent Component: ngOnInit() { this.parentForm = this.fb.group({ childForm1: etc }) Child Component: this.ChildForm = this.formBuilder.group({ 'streetNumber': [null, [Validators.required, Validators.maxLength(32)]], 'streetType': [null, [Validators.maxLength(8)]], 'city': [null, [Validators.maxLength(32)]],

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": {

Issue after upgrading Angular 4 to angular 8

梦想与她 提交于 2020-01-22 01:24:31
问题 Currently I am using Angular 4 in my application with system.js. Now I am updating it to Angular 8. For that I follow below 2 links: upgrade angular 4 project to angular 6 https://www.talkingdotnet.com/upgrade-angular-4-app-angular-5-visual-studio-2017/ I did below changes : Updated all packages in package.json http to httpclient httpmodule to httpclientmodule http request (map.json) rxjs changes When I run application after all changes and I am getting below error: Uncaught SyntaxError:

Refer to FormBuilder Members in a Strongly Typed list in Angular 8

一曲冷凌霜 提交于 2020-01-21 10:24:47
问题 We are trying to refer to Formcontrols in a Formbuilder in a strongly typed way. Currently have a Formbuilder with 20+ fields, and need to toggle off validators and visibility, etc. Instead of having multiple boolean flags for each, we want to provide an array, that will show which forms to toggle off. We are applying formbuilder,not formarrays due to styling complicated reasons. Toggle Multiple Fields On/Off in Formbuilder, clean syntax in Angular? Found a way to strong type formcontrols in

Refer to FormBuilder Members in a Strongly Typed list in Angular 8

荒凉一梦 提交于 2020-01-21 10:24:37
问题 We are trying to refer to Formcontrols in a Formbuilder in a strongly typed way. Currently have a Formbuilder with 20+ fields, and need to toggle off validators and visibility, etc. Instead of having multiple boolean flags for each, we want to provide an array, that will show which forms to toggle off. We are applying formbuilder,not formarrays due to styling complicated reasons. Toggle Multiple Fields On/Off in Formbuilder, clean syntax in Angular? Found a way to strong type formcontrols in

Use Formbuilder with Enum in Angular 8

你。 提交于 2020-01-17 15:43:53
问题 Is there a way to tie an Enum to Formbuilder names? Below, is an enum, and want to convert enum to its string, and use with Formbuilder (rather than using strings in formbuilder) Is this possible in Angular? enum address{ city, state, zip } this.addressForm = this.formBuilder.group({ 'city': [null, [Validators.required, Validators.maxLength(200)]], 'state': [null, [Validators.maxLength(200)]], 'zip':[null,[Validators.maxLength(200)]] }); 回答1: Is there a specific reason to use an enum? I think

Use Formbuilder with Enum in Angular 8

我只是一个虾纸丫 提交于 2020-01-17 15:43:08
问题 Is there a way to tie an Enum to Formbuilder names? Below, is an enum, and want to convert enum to its string, and use with Formbuilder (rather than using strings in formbuilder) Is this possible in Angular? enum address{ city, state, zip } this.addressForm = this.formBuilder.group({ 'city': [null, [Validators.required, Validators.maxLength(200)]], 'state': [null, [Validators.maxLength(200)]], 'zip':[null,[Validators.maxLength(200)]] }); 回答1: Is there a specific reason to use an enum? I think