angular7

Angular Library Route Module does not work when imported in application

孤街醉人 提交于 2020-01-21 12:42:35
问题 I need a help about an issue that I cannot solve. I'm studying angular 7 library in order to add modularization to my application but module routes defined in library seems not work when install it in a application. I have created project to github to reproduce problem: Library test foo-lib External Applicationfoo-tester In each ReadMe file I have described how to reproduce this issue. I have created an example library (foo-lib) with its routing module with child route defined, then I had

Angular Library Route Module does not work when imported in application

笑着哭i 提交于 2020-01-21 12:42:00
问题 I need a help about an issue that I cannot solve. I'm studying angular 7 library in order to add modularization to my application but module routes defined in library seems not work when install it in a application. I have created project to github to reproduce problem: Library test foo-lib External Applicationfoo-tester In each ReadMe file I have described how to reproduce this issue. I have created an example library (foo-lib) with its routing module with child route defined, then I had

How many ways are there to increase the performance in angular? [closed]

独自空忆成欢 提交于 2020-01-21 10:14:07
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 14 days ago . I am an angular front end developer and I am new for testing the run time performance. For checking the performance I downloaded the google plugin, " Performance-Analyser ". And I got the performance time as below. For DOM processing itself, its taking 5.4 Secs. (For our

npm install shows error with git not found

岁酱吖の 提交于 2020-01-21 08:32:07
问题 enter image description hereI have recently added some dependencies to the package.JSON and tried installing npm . but it shows errors related to git nor found npm ERR! path git npm ERR! code ENOENT npm ERR! errno ENOENT npm ERR! syscall spawn git npm ERR! enoent Error while executing: npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/eligrey/FileSaver.js.git npm ERR! enoent npm ERR! enoent npm ERR! enoent spawn git ENOENT npm ERR! enoent This is related to npm not being able to

Switch between mobile or desktop template using condition in templateUrl (Angular 7)

房东的猫 提交于 2020-01-16 19:07:13
问题 I want to switch between a desktop and mobile template depending on the screen width to ensure my application is responsive. I am trying to do the following: @Component({ selector: 'app-root', templateUrl: "./" + (window.innerWidth < 768) ? "app.component.html" : "app.component.mobile.html", styleUrls: ['./app.component.css'] }) However, this is not working. Instead of the template loading, the string, "app.component.html" , appears on the screen instead. What is even more interesting is that

Make Module global available in Angular application

放肆的年华 提交于 2020-01-16 15:41:33
问题 I have the following Module which components I use on other modules: import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ClickOutsideModule } from "ng-click-outside"; import { PopupComponent} from './popup.component'; @NgModule({ declarations: [ PopupComponent ], imports: [ CommonModule, ClickOutsideModule ], exports: [ PopupComponent ], providers: [] }) export class PopupModule {} And I have my AppModule: import { NgModule } from '@angular/core'

Test Broadcast Service

会有一股神秘感。 提交于 2020-01-16 12:31:26
问题 Hi I am trying to write angular code for a component with an observable but I can't test the broadcast service. I get an error saying the service is not being called. How Should I access the service? Any help would be appreciated. Thank you. This is my component with the observable: ngOnInit(): void { this.subscription.add( this.broadcastService.subscribe('msal:acquireTokenSuccess', (payload) => { // do something here this.roleService.checkServerEventReviewers().subscribe(res => { this

Angular 8, can checkbox value pass onto components? not not in a parent/child relation

若如初见. 提交于 2020-01-16 11:58:21
问题 <input type=checkbox [(ngModel)]="myCheckBox" (ngChanged)="!myCheckBox"> for example, if I want the code above to pass the "checked" value, which is "true or false" to other components, so its contents can react based on "myCheckBox" true | false, and they are not in a parent child relationship, is there any way I can do that? Please help, really apprecipate it!!!! 回答1: You can implement it by different methods. For example: with EventEmitter or rxjs( Subject, BehaviourSubject); In my example

Angular 7 reading the first column of an excel file and save it into an array

会有一股神秘感。 提交于 2020-01-16 08:05:20
问题 I am trying to upload an excel file, where the first column is an ID column. I need to take all the IDs and save them into an array to use them later for data management. I am using XLSX library: import {read, write, utils} from 'xlsx'; And for the html: <input type="file" value="Upload Excel/CSV file" (change)="upload($event)" accept=".xlsx, .xls, .csv"/> <button mat-fab color="warn" (click)="read()"><mat-icon color="warn">attach_file</mat-icon>Read Data</button> I started with: read() {

In angular 7 , How do I populate a mat-table with a data from an object

╄→гoц情女王★ 提交于 2020-01-15 10:35:15
问题 Currently I have the following code to populate a table. In component.ts: import { HttpClient } from "@angular/common/http"; import { Component, OnInit } from "@angular/core"; import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { ActivatedRoute, Router } from "@angular/router"; import { MatTableDataSource } from "@angular/material/table"; @Component({ styleUrls: ["./styles.scss"], templateUrl: "./template.html" }) export class MyRouteData { employeeInfoTable: object;