angular5

How to use Hammer in angular universal

老子叫甜甜 提交于 2021-02-04 20:00:27
问题 Can anyone pls help me to fix hammer error })(window, document, 'Hammer'); ^ ReferenceError: window is not defined at Object._MAP.8 (/Users/ks89/git/universal-starter/dist/server.js:126460:4) in angular universal. 回答1: You need to import hammer from main.ts , not directly from the module. That way, it won't be included server side https://github.com/angular/material2/blob/master/guides/getting-started.md#step-5-gesture-support 来源: https://stackoverflow.com/questions/49335441/how-to-use-hammer

How to use secondary endpoints to create API for Angular library

送分小仙女□ 提交于 2021-01-29 14:10:34
问题 Scenario: I created a custom UI library using ng-packagr , exported custom components and some model classes. Problem: In main project, import statement works fine for exported components but it doesn't work for exported classes and webpack fails to compile giving error: module not found error can't resolve my-custom-library/models Library project code: Model class: src/app/modules/my-custom-module/models/my-model.ts export class MyModel { constructor() { // default values for props here } //

cant disappear placeholder after focus on it

淺唱寂寞╮ 提交于 2021-01-29 10:41:53
问题 Here I am using the angular material form for login form using Angular5. when the applications starts, the login form placeholder couldn't be over-written. But once one I logged in and logged out, then only the input fields would be over written. Screenshot <form [formGroup]="loginform" class="login-form"> <mat-icon style="font-size: 30px ">account_circle</mat-icon> <mat-form-field class="example-full-width"> <input matInput placeholder="Username" formControlName="userName"> </mat-form-field>

How to wait for subscribe to finish Angular 5?

点点圈 提交于 2021-01-29 07:30:41
问题 I am working on an Angular 5 app. I get an error because I have a function that executes before another function is done, hence getting a null variable. I have tried to use .map and .subscribe with Observable, but didn't succeed. Here is the code: loadData is called from my app.component class : ngOnInit() { this.dataService.loadData(sessionStorage.getItem(...); } While that function executes, another function from data.component class (dataService.getData) is called on initialization:

Dynamically add elements to the editable div with Angular and ANYWHERE

房东的猫 提交于 2021-01-29 07:26:27
问题 So, I am creating an HTML interface where user should be able to write a text and push it as a notification to our mobile app. I am facing some troubleshoots with the text and the dynamic inserted elements using Angular 5; The text can contain special elements like: phone number, Location and website URL. Those special elements will be inserted by pressing on a button that opens a dialog, and for each one its specific fields are displayed, like google maps for location and input fields for

Is it possible to use Java methods from *.jar files in angular 5 services?

三世轮回 提交于 2021-01-29 06:22:58
问题 I am new to Angular, I am wondering if there is any possibility of importing *.jar files inside Angular 5 components or Services. Thanks in advance!! 来源: https://stackoverflow.com/questions/52412891/is-it-possible-to-use-java-methods-from-jar-files-in-angular-5-services

Angular 5 - Asynchronous Service Calls in two different components (First Method Not waiting for DB response)

↘锁芯ラ 提交于 2021-01-28 18:50:07
问题 I have to perform two different DB transactions on a single (click) event. First Call : Save Data to DB. Second Call : Get the first call's saved data from DB These calls are separated in two different components and deal with one common DB Table. My approach is below : First Component TS : ngOnDestroy(){ this.saveData(); } Second Component TS : ngOnInit(){ this.getSavedData(); } Service call for First Method to Execute : saveData(obj) { return this.http.post(environment.appUrl + 'saveDataApi

Angular: tree view from json data

情到浓时终转凉″ 提交于 2021-01-28 09:21:46
问题 I am new to angular. I want to create a expandable tree in angular 5. I have tried to using Angular-tree-component and ngx-treeview. but the problem with them is they need a json in specif format. is there any library which reads a any type of json and creates a expandable tree ? or do I need to convert my json in the format this npm modules will need it ? I want to do something like tree-grid-directive(http://khan4019.github.io/tree-grid-directive/test/treeGrid.html) is providing in angular

How can I get an Angular 5 component element's position?

懵懂的女人 提交于 2021-01-28 08:59:22
问题 In an angular 5 component I have a table , and I need to create something like overlaying multiple div s above several td 's. What's the best way to get the position of those td 's in the table so I can position the other elements? I'm currently trying to use something like @ViewChild('table') tableElement: ElementRef ngAfterViewChecked() { this.tableElement.nativeElement.getElementsByClassName('cell') // ... } But I'm risking some weird infinite loops doing it this way. Is there a way to