angular

Angular dependency with “providedIn” in lazy loading modules

北城以北 提交于 2021-02-11 15:15:21
问题 I am using Angular "Lazy-loading feature modules" as an example: live demo CustomersModule is a lazy loading module i create a test service in customer module. const routes: Routes = [ { path: 'customers', loadChildren: () => import('./customers/customers.module').then(m => m.CustomersModule) }, { path: 'orders', loadChildren: () => import('./orders/orders.module').then(m => m.OrdersModule) }, { path: '', redirectTo: '', pathMatch: 'full' } ]; import { Injectable } from '@angular/core';

Expression has changed after it was checked in angular 9

。_饼干妹妹 提交于 2021-02-11 15:10:42
问题 I am working on Angular 9 and I have encountered an error. Please help me. HTML: <div *ngFor="let item of users"> <p>{{ countFalse(item.userId) }}</p> </div> TS: interface IUser { userId: number; name: string; act: IAct[]; } interface IAct { actId: number; avtive: boolean; ... } users: IUser[] = []; countFalse(id): number { const index = this.users.findindex((u) => u.userId == userId); const a = this.users[index].act.length; return a; } console: 回答1: You need to reimplement your component.

bind status value from component to html in angular-calendar

霸气de小男生 提交于 2021-02-11 15:09:24
问题 I'am using angular-calendar with a custom template as given here : https://mattlewis92.github.io/angular-calendar/#/custom-templates, I have array of date and status of task on that date in my component arr = [ { 3: "success" }, { 1: "Rejected" }, { 18: "success" }, { 10: "Pending" }, { 9: "success" }, { 8: "Rejected" }, ] in html file i have dropdown in cell of calender month view What i want to do is if status on date given in arr is "success" then in calendar on that date dropdown selected

I want to make an e-commerce Filter By Category in Angular

爷,独闯天下 提交于 2021-02-11 14:59:04
问题 I tried but, I guess I coded exactly opposite that what I wanted. 1. all-trades.component.html <div fxLayout="row" fxLayout.lt-md="column" fxLayoutAlign="space-between start" fxLayoutAlign.lt-md="start stretch" *ngIf="crops$ | async" > <div class="container-outer" fxFlex="20"> <div class="filters"> <section class="example-section"> <span class="example-list-section"> <h1>Select Crop</h1> </span> <span class="example-list-section"> <ul> <li *ngFor="let filter of nameFilters$ | async"> <mat

angular using ngRx store and pipe async not get update in the DOM

隐身守侯 提交于 2021-02-11 14:54:30
问题 I use the async pipe for the observable data to show in my template. In my typescript component onInit ngOnInit() { this.data$ = this.myStore.pipe(select(dataRx.getData)); } In html, i use async pipe and using virtual scrolling <cdk-virtual-scroll-viewport [itemSize]="50" class="data-viewport" (scrolledIndexChange)="scrollIndexChange($event)"> <div *cdkVirtualFor="let item of data$ | async; trackBy: trackByFn; let index = index;" class="data-item"> <div>{{index}} {{ item.id}} {{ item.text }}<

Firestore Security Rules Permission Issue

限于喜欢 提交于 2021-02-11 14:52:38
问题 I have documents in firestore collection called 'inventories' of the following structure: { creator: string, images: string[], } the creator field is the uid of the user who created the document. In my firestore rules section I have the following rules: service cloud.firestore { match /databases/{database}/documents { match /inventories/{inventoryid} { allow read, write: if request.auth.id == resource.data.creator; } } } In my ionic application I do the following: this.inventoryCollection =

angular using ngRx store and pipe async not get update in the DOM

一笑奈何 提交于 2021-02-11 14:50:47
问题 I use the async pipe for the observable data to show in my template. In my typescript component onInit ngOnInit() { this.data$ = this.myStore.pipe(select(dataRx.getData)); } In html, i use async pipe and using virtual scrolling <cdk-virtual-scroll-viewport [itemSize]="50" class="data-viewport" (scrolledIndexChange)="scrollIndexChange($event)"> <div *cdkVirtualFor="let item of data$ | async; trackBy: trackByFn; let index = index;" class="data-item"> <div>{{index}} {{ item.id}} {{ item.text }}<

Angular/Typescript - Change background color of a span when a link is clicked

旧巷老猫 提交于 2021-02-11 14:50:41
问题 I'm trying to change the color of a span when a link is clicked in order to indicate that it's checked. This must work in the form of a radio button, meaning that the color must disappear if another link is clicked (checked). I tried various methods using only html and css, but unfortunately I never managed to get it to work using :focus. At the moment, when I click on one of the filters there is no indication that one of the categories has been activated, heavily impacting the UX. I believe

Unable to change values in ion-select-multiple

戏子无情 提交于 2021-02-11 14:46:23
问题 I am using ion-select-multiple . It works perfectly fine normally. I have a requirement to pre select few options in it. I searched the web and found the solution, but after pre assigning the values, now when I try to change, it gives me error. Here is my home.html code: <ion-select multiple="true" okText="Okay" cancelText="Dismiss" [(ngModel)]="followers" [value]="{$value: followers}"> <ion-select-option value="brown">Brown</ion-select-option> <ion-select-option value="blonde">Blonde</ion

Internet Explorer says 'Invalid character in vendor.js' ( ` )

杀马特。学长 韩版系。学妹 提交于 2021-02-11 14:39:40
问题 Angular 7 application not working on internet explorer. It says invalid character in vendor.js I have already apply polyfills.ts changes but it still not working. my tsconfig.json => { "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "module": "es2015", "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "importHelpers": true, "target": "es5", "typeRoots": [ "node_modules/