angular content projection

1, Ng content for content projection 1.1 ng-content The ng content element is a placeholder for inserting external or dynamic content. The parent component passes the external content to the child component. When Angular parses the template, it will insert the external content where ng content appears in the child component template. We can ...

Posted by zzlong on Sat, 05 Mar 2022 05:32:51 +0100

How to observe the execution of methods in parent components in child components

We may encounter the following situations:At present, we need to write an auto complete component. When the content entered by the user is recorded in the database, it will be saved according to the record. If there is no record, the content entered by the user will be stored in the database as an entity before saving. But we certainly can't st ...

Posted by GundamSV7 on Fri, 04 Mar 2022 07:14:23 +0100

Angular Basics - Rxjs II: distinct, distinct utilchanged, filter

Introduction to RxJS Reactive Extensions for JavaScript RxJS is a library that uses observable sequences to write asynchronous and event based programs. It provides a core type Observable , dependent types (observers, Schedulers, Subjects) and operators inspired by [Array#extras] (map, filter, reduce, every, etc.) can handle asynchro ...

Posted by Ryaan on Mon, 28 Feb 2022 06:31:45 +0100

Angular life cycle practice

Angular life cycle practiceThe meaning of life cycle hooksIn Angular, the method of realizing the life cycle hook interface of components is to use the Angular framework to realize the time point of inserting business.What is the life cycle in official documentsThere is a chapter in the official document of Angular Lifecycle hooks To explain th ...

Posted by squalls_dreams on Sat, 26 Feb 2022 03:30:31 +0100

Use RxJs to implement an Angular Component that supports infinite scroll

First, let's take a look at the runtime effect of my Angular application that supports infinite scroll:https://jerry-infinite-scroll...Scroll the middle mouse button and scroll down to trigger the list to continuously send requests to the background to load new data:The following are the specific development steps.(1) app.component.html source ...

Posted by dcole on Mon, 14 Feb 2022 05:27:32 +0100

Solve the problem that ng serve starts slow ly after upgrading to Angular v13

Recently, we are upgrading the company's Angular project. The project is built with Angular cli, and the UI uses Angular metal library and lazy loading route. The Angular version is upgraded from v10 to v13. Upgrade instructions: https://update.angular.io/ Problem: after upgrading, ng serve compilation is very slow It takes 90 seconds just ...

Posted by google_man2000 on Fri, 04 Feb 2022 13:35:20 +0100

How to limit file type and file size when uploading files with NZ upload component

Original link: here 0. Preface The component used at the front end of the project is Ant Design. Recently, I happened to see the debugging project using NZ uoload to upload files. However, it is required to limit the type of file upload. This article briefly records the process. angular+Ant Design for Angular 1.HTML file <nz-upload [(nzF ...

Posted by freeme on Wed, 02 Feb 2022 20:13:54 +0100

A specific use example of rxjs combinelate operator

CombineLatest Usage scenarios: This operator is best used when you have multiple, long-lived observables that rely on each other for some calculation or determination. When there are multiple Observable objects that live for a long time and depend on each other to complete some calculation logic, CombineLatest is suitable When any ob ...

Posted by j0hn_ on Mon, 31 Jan 2022 08:42:24 +0100

Angular dependency injection principle

Dependency injection is a major feature of Angular, through which you can write more maintainable code. But the JavaScript language itself does not provide the function of dependency injection, so how does Angular implement the function of dependency injection? Read this article and you will find the answer.A typical Angular application, from t ...

Posted by djloc286 on Tue, 25 Jan 2022 21:41:01 +0100

Two practices on Websocket (Vue project realizes online chat & Angular project pushes chart data in real time on the home page)

Abstract: This article records my two practical experiences in using websocket. In the first practice, I stepped on a lot of holes. The second practice is handy, but many theories are still lacking. Through this article, from theory to practice, we won it all in one fell swoop. catalogue 1, Websocket theory (1) What is Websocket? (2) What i ...

Posted by SithLordKyle on Mon, 17 Jan 2022 02:36:14 +0100