随笔分类 -  Angular

1 2 3 4 5 ··· 23 下一页
摘要:Service: fromObservable & fromSignalcan transform observable to and from signals. import { HttpClient, HttpErrorResponse } from '@angular/common/http' 阅读全文
posted @ 2023-04-13 13:56 Zhentiw 阅读(100) 评论(0) 推荐(0) 编辑
摘要:Provide application level module in bootstrapApplication bootstrapApplication(AppComp, { providers: [ importProvidersFrom(HttpClinetModule) ] }) //BAD 阅读全文
posted @ 2022-10-02 21:35 Zhentiw 阅读(26) 评论(0) 推荐(0) 编辑
摘要:{ path: 'admin', // load standalone component loadComponent: () => import('./feature/admin/admin.component').then(c => c.AdminComponent), // Swap User 阅读全文
posted @ 2022-06-22 13:56 Zhentiw 阅读(26) 评论(0) 推荐(0) 编辑
摘要:Before v14, we do DI like this: @Component({ name: 'app-root', template: `<h1>Hello!</h1>` }) export class AppComponent { constructor(private http: Ht 阅读全文
posted @ 2022-06-20 22:18 Zhentiw 阅读(53) 评论(0) 推荐(0) 编辑
摘要:There are two async exection context: Microtask Queue - ASAP (Promises, MutationObserver) Macrotask Queue - DO Later (setTimeout, setInterval, request 阅读全文
posted @ 2021-11-24 15:43 Zhentiw 阅读(46) 评论(0) 推荐(0) 编辑
摘要:There are many ways to expose data to components, but based on different usecase, different solution has PROS & CONS. 1. ShareReplay(1) PROS: ShareRep 阅读全文
posted @ 2021-10-06 14:24 Zhentiw 阅读(32) 评论(0) 推荐(0) 编辑
摘要:Some basic exmaple on Doc: https://material.angular.io/cdk/overlay/overview <!-- This button triggers the overlay and is it's origin --> <button (clic 阅读全文
posted @ 2021-09-30 18:42 Zhentiw 阅读(345) 评论(0) 推荐(0) 编辑
摘要:In this lesson we're diving a bit deeper and learn how to inject services into Formly Extensions with the example of using ngx-translate to localize a 阅读全文
posted @ 2021-04-29 22:44 Zhentiw 阅读(454) 评论(0) 推荐(0) 编辑
摘要:When you use TypeScript's --strictNullChecks flag, you can prevent the type checker from throwing an error with Angular's non-null assertion operator, 阅读全文
posted @ 2021-04-19 18:23 Zhentiw 阅读(84) 评论(0) 推荐(0) 编辑
摘要:Sometimes a binding expression triggers a type error during AOT compilation and it is not possible or difficult to fully specify the type. To silence 阅读全文
posted @ 2021-04-19 18:21 Zhentiw 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2021-03-03 19:28 Zhentiw 阅读(47) 评论(0) 推荐(0) 编辑
摘要:Let's say we have a date picker compoent which display start date and end date. We want to make sure that start date is no later than end date, if it 阅读全文
posted @ 2021-02-28 17:20 Zhentiw 阅读(49) 评论(0) 推荐(0) 编辑
摘要:Define an action to update the record: import { createAction, props } from "@ngrx/store"; import { Update } from "@ngrx/entity"; import { Course } fro 阅读全文
posted @ 2020-11-30 19:13 Zhentiw 阅读(112) 评论(0) 推荐(0) 编辑
摘要:Reducer: import { Course, compareCourses } from "../model/course"; import { EntityState, createEntityAdapter } from "@ngrx/entity"; import { createRed 阅读全文
posted @ 2020-11-30 04:05 Zhentiw 阅读(276) 评论(0) 推荐(0) 编辑
摘要:npm install cookies-js --save import {Component, OnInit} from '@angular/core'; import {FormGroup, FormBuilder, Validators} from "@angular/forms"; impo 阅读全文
posted @ 2020-10-19 23:14 Zhentiw 阅读(154) 评论(0) 推荐(0) 编辑
摘要:// course-detail.resolver.ts import {Resolve, ActivatedRouteSnapshot, RouterStateSnapshot} from "@angular/router"; import {Course} from "../shared/mod 阅读全文
posted @ 2020-10-19 23:08 Zhentiw 阅读(135) 评论(0) 推荐(0) 编辑
摘要:For example we want to build pipe to sanitizer the url: @Pipe({ name: 'safeUrl' }) export class SafeUrlPipe implements PipeTransform { constructor(pri 阅读全文
posted @ 2020-10-19 22:41 Zhentiw 阅读(139) 评论(0) 推荐(0) 编辑
摘要:Today modern browsers added native support for lazy loading images, and we can benefit from it by adding one simple attribute to our img element: <img 阅读全文
posted @ 2020-09-01 22:33 Zhentiw 阅读(143) 评论(0) 推荐(0) 编辑

1 2 3 4 5 ··· 23 下一页
点击右上角即可分享
微信分享提示