angular

Disable dropdown close of multiselect on click of a field inside multiselect dropdown in PrimeNG

北战南征 提交于 2021-02-16 18:54:25
问题 I am working on a requirement in which I am using PrimeNG multiselect. This multiselect has checkboxes followed by some text and logo. On click of logo I am displaying some data in popup. On click of the ok button of popup the background multiselect closes, where in I need to disable closing of popup on click of logo. Heere is the stackblitz example for reference: Stackblitz Demo click here. Step 1: Open mutiselect and click on logo Step 2: Click ok of popup Step 3: Multiselect Dropdwon

Javascript, Typescript, Angular 5 - Open and read file

你说的曾经没有我的故事 提交于 2021-02-16 14:49:49
问题 I am working with Angular 5, I have an application in which I need to read an AMP HTML file as text. This file is contained in a component and should only be accessed from this component. I would like to be able to open the file in read-only by giving its name. I'm actually searching for something like this: let file = open('amp.html'); Is it possible? If not how can I do to achieve this? 回答1: If you're writing browserside JS You can't just simply read a file. The JS is running on your

using async pipe to the property on template

拥有回忆 提交于 2021-02-16 14:37:08
问题 export class MyClass { data: MyData; constructor(private dataService: DataService) { this.dataService.getData().subscribe((myData) => { this.data = myData; }); } } data is successfully retrieved trough web service. MyData object has property firstName which I want to represent inside template using async pipe. I tried with <input required [ngModel]="data.firstName | async" (ngModelChange)="onChange($event)" name="firstName"> this approach doesn't bind property to the template at all, [

Why Angular 8 router is not working in Cordova IOS with WkWebView?

女生的网名这么多〃 提交于 2021-02-16 14:08:09
问题 I have an existing application built with Angular 8 and its code is shared by a website and 2 mobile applications for Android and IOS , bundled with the help of Cordova . It is working fine but Apple has announced that they will soon no longer supports apps built with UIWebView : The App Store will no longer accept new apps using UIWebView as of April 2020 and app updates using UIWebView as of December 2020. So I am forced to migrate it to WkWebView . There are several threads that I am aware

Why Angular 8 router is not working in Cordova IOS with WkWebView?

倖福魔咒の 提交于 2021-02-16 14:06:26
问题 I have an existing application built with Angular 8 and its code is shared by a website and 2 mobile applications for Android and IOS , bundled with the help of Cordova . It is working fine but Apple has announced that they will soon no longer supports apps built with UIWebView : The App Store will no longer accept new apps using UIWebView as of April 2020 and app updates using UIWebView as of December 2020. So I am forced to migrate it to WkWebView . There are several threads that I am aware

Why use the RxJS .asObservable() getter/factory function pattern?

别说谁变了你拦得住时间么 提交于 2021-02-16 13:59:11
问题 In a lot of codebases using RxJS I seem to come across the pattern of exposing private Subjects as Observables via a getter or normal getObservable() function. My question is not why .asObservable() is used, but instead why it seems so commonly wrapped in a getter/factory function? asObservable() wrapped in getter/factory function private readonly _engineInfo$ = new Subject<EngineInfo>(); get engineInfo$() { return this._engineInfo$.asObservable(); } asObservable() as instance variable

'this' bound to subscribe function and not outer component scope in Angular2

Deadly 提交于 2021-02-16 13:08:35
问题 I am having an issue in one of my components in Angular2 where as 'this' is bound to wrong context within one of my components. I have other components where this issue is not occurring but I cannot see what the difference is. Here is my code: Component: import { Component, Input } from '@angular/core'; import { FilesService } from "./services/files.service"; @Component({ selector: 'my-app', moduleId: module.id, templateUrl:'/app/views/app.html' }) export class AppComponent { openFileUploader

HostListener to analyse combination key press

和自甴很熟 提交于 2021-02-16 04:24:54
问题 I am trying to trace when a user presses a Shift+Tab combination key using keyboard, but I am not able to fire that event @HostListener('keyup', ['$event']) @HostListener('keydown', ['$event']) onkeyup(event) { if (event.keyCode == 16 && event.keyCode == 9) { this.isShift = true; console.log("On Keyup " + event.keyCode); } } onkeydown(event) { console.log("On KeyDown" + event.keyCode); } 回答1: It works when I do this: @Directive({ selector: '[test-directive]' }) export class TestDirective {

How to get the values of checkbox instead of true

孤者浪人 提交于 2021-02-15 07:48:48
问题 I wanted to print the values of selected checkboxes instead of "Custom Category". I have tried to get value, attribute but not getting the values. I wanted to print the values of the selected checkbox. app.component.html <form #myForm="ngForm"> <div class="form-group"> <div class="form-check form-check-inline"> <input class="form-check-input" type="checkbox" id="dl1" required #dl="ngModel" value="DL1" ngModel name="dl"> <label class="form-check-label" for="">DL 1</label> </div> <div class=

Creating a custom component wrapping an input control on Angular for reactive forms

我的梦境 提交于 2021-02-11 18:16:12
问题 I'm trying to create a custom component with an input form control inside but I have no idea how to connect the directive formControl and formControlName to the inner input, this is my code: <div class="input-group"> <input class="form-control form-control-sm" #code /> <div class="input-group-append"> <button type="button" class="btn btn-sm btn-success" (click)="search()"> <i class="fa fa-search"></i> </button> </div> </div> this is the .ts file import { Input, Component, forwardRef, OnInit,