{"id":61507,"date":"2026-01-17T21:49:33","date_gmt":"2026-01-17T13:49:33","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/61507.html"},"modified":"2026-01-17T21:49:33","modified_gmt":"2026-01-17T13:49:33","slug":"angular%e7%bb%bc%e5%90%88%e5%ba%94%e7%94%a803%ef%bc%8c%e7%8e%a9%e8%bd%ac-angular-%e8%87%aa%e5%ae%9a%e4%b9%89%e7%ae%a1%e9%81%93%ef%bc%9a%e5%b0%81%e8%a3%85%e5%a4%8d%e6%9d%82%e6%95%b0%e6%8d%ae%e6%a0%bc","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/61507.html","title":{"rendered":"Angular\u7efc\u5408\u5e94\u752803\uff0c\u73a9\u8f6c Angular \u81ea\u5b9a\u4e49\u7ba1\u9053\uff1a\u5c01\u88c5\u590d\u6742\u6570\u636e\u683c\u5f0f\u5316\u4e0e\u4e1a\u52a1\u903b\u8f91"},"content":{"rendered":"<p>\u5728 Angular \u5f00\u53d1\u4e2d&#xff0c;\u7ba1\u9053&#xff08;Pipe&#xff09;\u662f\u5904\u7406\u6570\u636e\u683c\u5f0f\u5316\u7684\u6838\u5fc3\u5de5\u5177&#xff0c;Angular \u5185\u7f6e\u7684date\u3001uppercase\u3001currency\u7b49\u7ba1\u9053\u80fd\u6ee1\u8db3\u57fa\u7840\u9700\u6c42&#xff0c;\u4f46\u9762\u5bf9\u590d\u6742\u7684\u4e1a\u52a1\u573a\u666f&#xff08;\u5982\u591a\u7ef4\u5ea6\u6570\u636e\u8f6c\u6362\u3001\u72b6\u6001\u6620\u5c04\u3001\u4e2a\u6027\u5316\u683c\u5f0f\u5316&#xff09;&#xff0c;\u81ea\u5b9a\u4e49\u7ba1\u9053\u6210\u4e3a\u63d0\u5347\u4ee3\u7801\u590d\u7528\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u7684\u5173\u952e\u3002\u672c\u6587\u5c06\u4ece\u5b9e\u9645\u4e1a\u52a1\u573a\u666f\u51fa\u53d1&#xff0c;\u8be6\u89e3\u5982\u4f55\u901a\u8fc7\u81ea\u5b9a\u4e49\u7ba1\u9053\u5c01\u88c5\u590d\u6742\u903b\u8f91&#xff0c;\u8ba9\u6a21\u677f\u66f4\u7b80\u6d01\u3001\u4e1a\u52a1\u66f4\u805a\u7126\u3002<\/p>\n<h3>\u4e00\u3001\u81ea\u5b9a\u4e49\u7ba1\u9053\u7684\u6838\u5fc3\u4ef7\u503c<\/h3>\n<p>\u5728\u5f00\u59cb\u7f16\u7801\u524d&#xff0c;\u5148\u660e\u786e\u81ea\u5b9a\u4e49\u7ba1\u9053\u7684\u6838\u5fc3\u4f18\u52bf&#xff1a;<\/p>\n<li>\u6a21\u677f\u89e3\u8026&#xff1a;\u5c06\u6570\u636e\u683c\u5f0f\u5316\u903b\u8f91\u4ece\u6a21\u677f\u4e2d\u62bd\u79bb&#xff0c;\u907f\u514d\u6a21\u677f\u5145\u65a5\u5927\u91cf*ngIf\/*ngFor\u5d4c\u5957\u6216\u590d\u6742\u8868\u8fbe\u5f0f&#xff1b;<\/li>\n<li>\u903b\u8f91\u590d\u7528&#xff1a;\u540c\u4e00\u683c\u5f0f\u5316\u89c4\u5219&#xff08;\u5982\u8ba2\u5355\u72b6\u6001\u8f6c\u6362\u3001\u91d1\u989d\u5206\u8f6c\u5143&#xff09;\u53ef\u5728\u7ec4\u4ef6\u3001\u6a21\u677f\u3001\u670d\u52a1\u4e2d\u590d\u7528&#xff1b;<\/li>\n<li>\u53ef\u6d4b\u8bd5\u6027&#xff1a;\u72ec\u7acb\u7684\u7ba1\u9053\u7c7b\u4fbf\u4e8e\u7f16\u5199\u5355\u5143\u6d4b\u8bd5&#xff0c;\u4fdd\u969c\u683c\u5f0f\u5316\u903b\u8f91\u7684\u51c6\u786e\u6027&#xff1b;<\/li>\n<li>\u4e1a\u52a1\u805a\u7126&#xff1a;\u7ba1\u9053\u4e13\u6ce8\u5904\u7406\u6570\u636e\u8f6c\u6362&#xff0c;\u7ec4\u4ef6\u53ea\u9700\u5173\u6ce8\u4e1a\u52a1\u903b\u8f91&#xff0c;\u7b26\u5408\u5355\u4e00\u804c\u8d23\u539f\u5219\u3002<\/li>\n<h3>\u4e8c\u3001\u57fa\u7840\u5b9e\u73b0&#xff1a;\u4ece\u7b80\u5355\u5230\u590d\u6742<\/h3>\n<h4>1. \u5feb\u901f\u521b\u5efa\u81ea\u5b9a\u4e49\u7ba1\u9053<\/h4>\n<p>Angular \u63d0\u4f9b\u4e86ng generate pipe&#xff08;\u7b80\u5199ng g p&#xff09;\u547d\u4ee4\u5feb\u901f\u751f\u6210\u7ba1\u9053\u6a21\u677f&#xff0c;\u4ee5 \u201c\u8ba2\u5355\u72b6\u6001\u683c\u5f0f\u5316\u201d \u4e3a\u4f8b&#xff1a;<\/p>\n<p># \u751f\u6210\u72b6\u6001\u683c\u5f0f\u5316\u7ba1\u9053<br \/>\nng g p pipes\/order-status<\/p>\n<p>\u751f\u6210\u7684\u57fa\u7840\u7ed3\u6784\u5305\u542b\u4e24\u4e2a\u6838\u5fc3\u90e8\u5206&#xff1a;<\/p>\n<ul>\n<li>&#064;Pipe\u88c5\u9970\u5668&#xff1a;\u5b9a\u4e49\u7ba1\u9053\u540d\u79f0&#xff08;\u6a21\u677f\u4e2d\u4f7f\u7528&#xff09;\u3001\u662f\u5426\u7eaf\u7ba1\u9053&#xff08;pure&#xff09;&#xff1b;<\/li>\n<li>transform\u65b9\u6cd5&#xff1a;\u6838\u5fc3\u903b\u8f91\u5b9e\u73b0&#xff0c;\u63a5\u6536\u5f85\u5904\u7406\u6570\u636e\u548c\u53ef\u9009\u53c2\u6570&#xff0c;\u8fd4\u56de\u683c\u5f0f\u5316\u7ed3\u679c\u3002<\/li>\n<\/ul>\n<h4>2. \u573a\u666f 1&#xff1a;\u57fa\u7840\u72b6\u6001\u6620\u5c04&#xff08;\u7eaf\u7ba1\u9053&#xff09;<\/h4>\n<p>\u4e1a\u52a1\u9700\u6c42&#xff1a;\u5c06\u8ba2\u5355\u72b6\u6001\u7801&#xff08;\u6570\u5b57&#xff09;\u8f6c\u6362\u4e3a\u4e2d\u6587\u540d\u79f0 &#043; \u5bf9\u5e94\u6837\u5f0f\u7c7b&#xff0c;\u59820\u2192\u5f85\u652f\u4ed8&#xff08;warning&#xff09;\u30011\u2192\u5df2\u652f\u4ed8&#xff08;success&#xff09;\u30012\u2192\u5df2\u53d6\u6d88&#xff08;danger&#xff09;\u3002<\/p>\n<p>\/\/ src\/app\/pipes\/order-status\/order-status.pipe.ts<br \/>\nimport { Pipe, PipeTransform } from &#039;&#064;angular\/core&#039;;<\/p>\n<p>\/\/ \u5b9a\u4e49\u72b6\u6001\u6620\u5c04\u63a5\u53e3&#xff0c;\u63d0\u5347\u7c7b\u578b\u5b89\u5168\u6027<br \/>\ninterface OrderStatusMap {<br \/>\n  label: string;<br \/>\n  class: string;<br \/>\n}<\/p>\n<p>&#064;Pipe({<br \/>\n  name: &#039;orderStatus&#039;, \/\/ \u6a21\u677f\u4e2d\u4f7f\u7528\u7684\u7ba1\u9053\u540d\u79f0<br \/>\n  pure: true \/\/ \u7eaf\u7ba1\u9053&#xff1a;\u4ec5\u5f53\u8f93\u5165\u503c\/\u53c2\u6570\u53d8\u5316\u65f6\u89e6\u53d1&#xff0c;\u6027\u80fd\u66f4\u4f18<br \/>\n})<br \/>\nexport class OrderStatusPipe implements PipeTransform {<br \/>\n  \/\/ \u72b6\u6001\u6620\u5c04\u8868&#xff1a;\u96c6\u4e2d\u7ba1\u7406&#xff0c;\u4fbf\u4e8e\u7ef4\u62a4<br \/>\n  private statusMap: Record&lt;number, OrderStatusMap&gt; &#061; {<br \/>\n    0: { label: &#039;\u5f85\u652f\u4ed8&#039;, class: &#039;text-warning&#039; },<br \/>\n    1: { label: &#039;\u5df2\u652f\u4ed8&#039;, class: &#039;text-success&#039; },<br \/>\n    2: { label: &#039;\u5df2\u53d6\u6d88&#039;, class: &#039;text-danger&#039; },<br \/>\n    3: { label: &#039;\u9000\u6b3e\u4e2d&#039;, class: &#039;text-info&#039; },<br \/>\n    4: { label: &#039;\u5df2\u9000\u6b3e&#039;, class: &#039;text-gray&#039; }<br \/>\n  };<\/p>\n<p>  \/**<br \/>\n   * \u8f6c\u6362\u8ba2\u5355\u72b6\u6001<br \/>\n   * &#064;param value \u72b6\u6001\u7801&#xff08;\u5fc5\u586b&#xff09;<br \/>\n   * &#064;param type \u8fd4\u56de\u7c7b\u578b&#xff1a;&#039;label&#039;&#xff08;\u9ed8\u8ba4&#xff09;| &#039;class&#039; | &#039;all&#039;<br \/>\n   * &#064;returns \u683c\u5f0f\u5316\u7ed3\u679c<br \/>\n   *\/<br \/>\n  transform(value: number, type: &#039;label&#039; | &#039;class&#039; | &#039;all&#039; &#061; &#039;label&#039;): string | OrderStatusMap {<br \/>\n    \/\/ \u8fb9\u754c\u5904\u7406&#xff1a;\u7a7a\u503c\/\u65e0\u6548\u72b6\u6001\u7801<br \/>\n    if (value &#061;&#061;&#061; null || value &#061;&#061;&#061; undefined || !this.statusMap[value]) {<br \/>\n      return type &#061;&#061;&#061; &#039;all&#039; ? { label: &#039;\u672a\u77e5\u72b6\u6001&#039;, class: &#039;text-default&#039; } : &#039;\u672a\u77e5\u72b6\u6001&#039;;<br \/>\n    }<\/p>\n<p>    const result &#061; this.statusMap[value];<br \/>\n    return type &#061;&#061;&#061; &#039;all&#039; ? result : result[type];<br \/>\n  }<br \/>\n}<\/p>\n<p>\u6a21\u677f\u4e2d\u4f7f\u7528&#xff1a;<\/p>\n<p>&lt;!&#8211; 1. \u4ec5\u663e\u793a\u72b6\u6001\u6587\u672c &#8211;&gt;<br \/>\n&lt;span&gt;{{ order.status | orderStatus }}&lt;\/span&gt;<\/p>\n<p>&lt;!&#8211; 2. \u4ec5\u83b7\u53d6\u6837\u5f0f\u7c7b &#8211;&gt;<br \/>\n&lt;span [ngClass]&#061;&#034;order.status | orderStatus: &#039;class&#039;&#034;&gt;{{ order.status | orderStatus }}&lt;\/span&gt;<\/p>\n<p>&lt;!&#8211; 3. \u83b7\u53d6\u5b8c\u6574\u4fe1\u606f&#xff08;\u7ed3\u5408ng-template&#xff09; &#8211;&gt;<br \/>\n&lt;ng-container *ngIf&#061;&#034;order.status | orderStatus: &#039;all&#039; as status&#034;&gt;<br \/>\n  &lt;span [ngClass]&#061;&#034;status.class&#034;&gt;{{ status.label }}&lt;\/span&gt;<br \/>\n&lt;\/ng-container&gt;<\/p>\n<h4>3. \u573a\u666f 2&#xff1a;\u590d\u6742\u6570\u636e\u8ba1\u7b97&#xff08;\u975e\u7eaf\u7ba1\u9053&#xff09;<\/h4>\n<p>\u4e1a\u52a1\u9700\u6c42&#xff1a;\u6839\u636e\u5546\u54c1\u5217\u8868\u8ba1\u7b97\u8d2d\u7269\u8f66\u603b\u91d1\u989d&#xff08;\u542b\u6298\u6263\u3001\u6ee1\u51cf&#xff09;&#xff0c;\u4e14\u9700\u5b9e\u65f6\u54cd\u5e94\u6570\u636e\u53d8\u5316&#xff08;\u5982\u5546\u54c1\u6570\u91cf\u4fee\u6539\u3001\u6298\u6263\u5238\u5207\u6362&#xff09;\u3002<\/p>\n<p>\u6ce8\u610f&#xff1a;\u7eaf\u7ba1\u9053&#xff08;pure: true&#xff09;\u4ec5\u5728\u8f93\u5165\u503c\u5f15\u7528\u53d8\u5316\u65f6\u89e6\u53d1&#xff0c;\u82e5\u8f93\u5165\u662f\u6570\u7ec4 \/ \u5bf9\u8c61&#xff08;\u5982\u8d2d\u7269\u8f66\u5217\u8868&#xff09;&#xff0c;\u4fee\u6539\u5185\u90e8\u5143\u7d20&#xff08;\u5982cartItems[0].count&#043;&#043;&#xff09;\u4e0d\u4f1a\u89e6\u53d1\u91cd\u65b0\u8ba1\u7b97&#xff0c;\u6b64\u65f6\u9700\u4f7f\u7528\u975e\u7eaf\u7ba1\u9053&#xff08;pure: false&#xff09;\u3002<\/p>\n<p>\/\/ src\/app\/pipes\/cart-total\/cart-total.pipe.ts<br \/>\nimport { Pipe, PipeTransform } from &#039;&#064;angular\/core&#039;;<\/p>\n<p>\/\/ \u5546\u54c1\u7c7b\u578b\u5b9a\u4e49<br \/>\ninterface CartItem {<br \/>\n  price: number; \/\/ \u5355\u4ef7&#xff08;\u5206&#xff09;<br \/>\n  count: number; \/\/ \u6570\u91cf<br \/>\n  discount: number; \/\/ \u5355\u54c1\u6298\u6263&#xff08;0-1&#xff0c;\u59820.8&#061;8\u6298&#xff09;<br \/>\n}<\/p>\n<p>\/\/ \u6298\u6263\u5238\u7c7b\u578b<br \/>\ninterface Coupon {<br \/>\n  type: &#039;fullReduce&#039; | &#039;rate&#039;; \/\/ \u6ee1\u51cf\/\u6298\u6263<br \/>\n  value: number; \/\/ \u6ee1\u51cf\u91d1\u989d&#xff08;\u5206&#xff09;\/\u6298\u6263\u7387&#xff08;0-1&#xff09;<br \/>\n  threshold: number; \/\/ \u6ee1\u51cf\u95e8\u69db&#xff08;\u5206&#xff09;<br \/>\n}<\/p>\n<p>&#064;Pipe({<br \/>\n  name: &#039;cartTotal&#039;,<br \/>\n  pure: false \/\/ \u975e\u7eaf\u7ba1\u9053&#xff1a;\u6bcf\u6b21\u53d8\u66f4\u68c0\u6d4b\u90fd\u4f1a\u89e6\u53d1&#xff0c;\u6ce8\u610f\u6027\u80fd<br \/>\n})<br \/>\nexport class CartTotalPipe implements PipeTransform {<br \/>\n  \/**<br \/>\n   * \u8ba1\u7b97\u8d2d\u7269\u8f66\u603b\u91d1\u989d<br \/>\n   * &#064;param cartItems \u5546\u54c1\u5217\u8868<br \/>\n   * &#064;param coupon \u6298\u6263\u5238&#xff08;\u53ef\u9009&#xff09;<br \/>\n   * &#064;returns \u6700\u7ec8\u91d1\u989d&#xff08;\u5143&#xff0c;\u4fdd\u75592\u4f4d\u5c0f\u6570&#xff09;<br \/>\n   *\/<br \/>\n  transform(cartItems: CartItem[], coupon?: Coupon): number {<br \/>\n    \/\/ \u8fb9\u754c\u5904\u7406&#xff1a;\u7a7a\u5217\u8868<br \/>\n    if (!cartItems || cartItems.length &#061;&#061;&#061; 0) {<br \/>\n      return 0;<br \/>\n    }<\/p>\n<p>    \/\/ 1. \u8ba1\u7b97\u5546\u54c1\u5c0f\u8ba1&#xff08;\u5355\u54c1\u5355\u4ef7*\u6570\u91cf*\u6298\u6263&#xff09;<br \/>\n    let subtotal &#061; cartItems.reduce((sum, item) &#061;&gt; {<br \/>\n      const itemTotal &#061; item.price * item.count * item.discount;<br \/>\n      return sum &#043; itemTotal;<br \/>\n    }, 0);<\/p>\n<p>    \/\/ 2. \u5e94\u7528\u6298\u6263\u5238<br \/>\n    if (coupon) {<br \/>\n      switch (coupon.type) {<br \/>\n        case &#039;fullReduce&#039;:<br \/>\n          \/\/ \u6ee1\u51cf&#xff1a;\u8fbe\u5230\u95e8\u69db\u624d\u751f\u6548<br \/>\n          subtotal &#061; subtotal &gt;&#061; coupon.threshold ? subtotal &#8211; coupon.value : subtotal;<br \/>\n          break;<br \/>\n        case &#039;rate&#039;:<br \/>\n          \/\/ \u6298\u6263&#xff1a;\u76f4\u63a5\u4e58\u4ee5\u6298\u6263\u7387<br \/>\n          subtotal &#061; subtotal * coupon.value;<br \/>\n          break;<br \/>\n      }<br \/>\n    }<\/p>\n<p>    \/\/ 3. \u8f6c\u6362\u4e3a\u5143\u5e76\u4fdd\u75592\u4f4d\u5c0f\u6570&#xff08;\u907f\u514d\u6d6e\u70b9\u7cbe\u5ea6\u95ee\u9898&#xff09;<br \/>\n    const total &#061; Math.round(subtotal) \/ 100;<br \/>\n    return Number(total.toFixed(2));<br \/>\n  }<br \/>\n}<\/p>\n<p>\u6a21\u677f\u4e2d\u4f7f\u7528&#xff1a;<\/p>\n<p>&lt;!&#8211; \u663e\u793a\u8d2d\u7269\u8f66\u603b\u91d1\u989d &#8211;&gt;<br \/>\n&lt;div class&#061;&#034;total-price&#034;&gt;<br \/>\n  \u5408\u8ba1&#xff1a;\u00a5{{ cartItems | cartTotal: selectedCoupon }}<br \/>\n&lt;\/div&gt;<\/p>\n<p>&lt;!&#8211; \u5546\u54c1\u6570\u91cf\u4fee\u6539\u540e&#xff0c;\u7ba1\u9053\u81ea\u52a8\u91cd\u65b0\u8ba1\u7b97 &#8211;&gt;<br \/>\n&lt;div *ngFor&#061;&#034;let item of cartItems&#034;&gt;<br \/>\n  &lt;button (click)&#061;&#034;item.count&#8211;&#034;&gt;-&lt;\/button&gt;<br \/>\n  &lt;span&gt;{{ item.count }}&lt;\/span&gt;<br \/>\n  &lt;button (click)&#061;&#034;item.count&#043;&#043;&#034;&gt;&#043;&lt;\/button&gt;<br \/>\n&lt;\/div&gt;<\/p>\n<p>\u6027\u80fd\u63d0\u793a&#xff1a;\u975e\u7eaf\u7ba1\u9053\u4f1a\u9891\u7e41\u89e6\u53d1&#xff0c;\u5efa\u8bae&#xff1a;<\/p>\n<li>\u5c3d\u91cf\u7f29\u5c0f\u7ba1\u9053\u4f5c\u7528\u57df&#xff08;\u5982\u4ec5\u5728\u8d2d\u7269\u8f66\u7ec4\u4ef6\u4f7f\u7528&#xff09;&#xff1b;<\/li>\n<li>\u590d\u6742\u8ba1\u7b97\u53ef\u7ed3\u5408ChangeDetectionStrategy.OnPush\u4f18\u5316\u7ec4\u4ef6\u53d8\u66f4\u68c0\u6d4b&#xff1b;<\/li>\n<li>\u9ad8\u9891\u66f4\u65b0\u7684\u6570\u636e\u53ef\u7f13\u5b58\u8ba1\u7b97\u7ed3\u679c&#xff0c;\u907f\u514d\u91cd\u590d\u8ba1\u7b97\u3002<\/li>\n<h4>4. \u573a\u666f 3&#xff1a;\u5f02\u6b65\u6570\u636e\u683c\u5f0f\u5316&#xff08;\u7ed3\u5408 Observable&#xff09;<\/h4>\n<p>\u4e1a\u52a1\u9700\u6c42&#xff1a;\u6839\u636e\u7528\u6237 ID \u5f02\u6b65\u83b7\u53d6\u7528\u6237\u540d&#xff0c;\u5e76\u5728\u6a21\u677f\u4e2d\u76f4\u63a5\u683c\u5f0f\u5316\u663e\u793a\u3002<\/p>\n<p>\/\/ src\/app\/pipes\/async-username\/async-username.pipe.ts<br \/>\nimport { Pipe, PipeTransform } from &#039;&#064;angular\/core&#039;;<br \/>\nimport { Observable, of } from &#039;rxjs&#039;;<br \/>\nimport { catchError, map } from &#039;rxjs\/operators&#039;;<br \/>\nimport { UserService } from &#039;..\/services\/user.service&#039;;<\/p>\n<p>&#064;Pipe({<br \/>\n  name: &#039;asyncUsername&#039;<br \/>\n})<br \/>\nexport class AsyncUsernamePipe implements PipeTransform {<br \/>\n  constructor(private userService: UserService) {}<\/p>\n<p>  \/**<br \/>\n   * \u5f02\u6b65\u83b7\u53d6\u7528\u6237\u540d<br \/>\n   * &#064;param userId \u7528\u6237ID<br \/>\n   * &#064;returns \u7528\u6237\u540dObservable<br \/>\n   *\/<br \/>\n  transform(userId: string | number): Observable&lt;string&gt; {<br \/>\n    if (!userId) {<br \/>\n      return of(&#039;\u672a\u77e5\u7528\u6237&#039;);<br \/>\n    }<\/p>\n<p>    return this.userService.getUserNameById(userId).pipe(<br \/>\n      map(name &#061;&gt; name || &#039;\u533f\u540d\u7528\u6237&#039;),<br \/>\n      catchError(() &#061;&gt; of(&#039;\u83b7\u53d6\u5931\u8d25&#039;))<br \/>\n    );<br \/>\n  }<br \/>\n}<\/p>\n<p>\u6a21\u677f\u4e2d\u4f7f\u7528&#xff08;\u7ed3\u5408async\u7ba1\u9053&#xff09;&#xff1a;<\/p>\n<p>&lt;!&#8211; \u6ce8\u610f&#xff1a;async\u7ba1\u9053\u9700\u653e\u5728\u6700\u540e&#xff0c;\u4e14\u907f\u514d\u91cd\u590d\u8c03\u7528&#xff08;\u53ef\u4f7f\u7528as\u8bed\u6cd5\u7f13\u5b58&#xff09; &#8211;&gt;<br \/>\n&lt;ng-container *ngIf&#061;&#034;order.userId | asyncUsername | async as username&#034;&gt;<br \/>\n  &lt;span&gt;\u4e0b\u5355\u4eba&#xff1a;{{ username }}&lt;\/span&gt;<br \/>\n&lt;\/ng-container&gt;<\/p>\n<h3>\u4e09\u3001\u81ea\u5b9a\u4e49\u7ba1\u9053\u7684\u6700\u4f73\u5b9e\u8df5<\/h3>\n<h4>1. \u7ba1\u9053\u8bbe\u8ba1\u539f\u5219<\/h4>\n<ul>\n<li>\u5355\u4e00\u804c\u8d23&#xff1a;\u4e00\u4e2a\u7ba1\u9053\u53ea\u5904\u7406\u4e00\u7c7b\u903b\u8f91&#xff08;\u5982\u72b6\u6001\u6620\u5c04\u3001\u91d1\u989d\u8ba1\u7b97\u3001\u65e5\u671f\u683c\u5f0f\u5316&#xff09;&#xff0c;\u907f\u514d \u201c\u4e07\u80fd\u7ba1\u9053\u201d&#xff1b;<\/li>\n<li>\u8fb9\u754c\u5904\u7406&#xff1a;\u5fc5\u987b\u5904\u7406null\u3001undefined\u3001\u65e0\u6548\u503c\u7b49\u8fb9\u754c\u60c5\u51b5&#xff0c;\u907f\u514d\u6a21\u677f\u62a5\u9519&#xff1b;<\/li>\n<li>\u7c7b\u578b\u5b89\u5168&#xff1a;\u4f7f\u7528 TypeScript \u63a5\u53e3 \/ \u7c7b\u578b\u5b9a\u4e49\u8f93\u5165\u8f93\u51fa&#xff0c;\u63d0\u5347\u4ee3\u7801\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027&#xff1b;<\/li>\n<li>\u7eaf\u7ba1\u9053\u4f18\u5148&#xff1a;\u7eaf\u7ba1\u9053\u6027\u80fd\u66f4\u4f18&#xff0c;\u4ec5\u5728\u8f93\u5165\u5f15\u7528\u53d8\u5316\u65f6\u89e6\u53d1&#xff0c;\u975e\u7eaf\u7ba1\u9053\u9700\u8c28\u614e\u4f7f\u7528\u3002<\/li>\n<\/ul>\n<h4>2. \u7ba1\u9053\u7684\u590d\u7528\u4e0e\u6269\u5c55<\/h4>\n<ul>\n<li>\u62bd\u79bb\u516c\u5171\u903b\u8f91&#xff1a;\u5c06\u901a\u7528\u7684\u683c\u5f0f\u5316\u89c4\u5219&#xff08;\u5982\u91d1\u989d\u5206\u8f6c\u5143&#xff09;\u62bd\u79bb\u4e3a\u57fa\u7840\u7ba1\u9053&#xff0c;\u590d\u6742\u7ba1\u9053\u53ef\u4f9d\u8d56\u57fa\u7840\u7ba1\u9053&#xff1b;<\/li>\n<li>\u53c2\u6570\u5316\u8bbe\u8ba1&#xff1a;\u901a\u8fc7\u53c2\u6570&#xff08;\u5982transform\u7684\u7b2c\u4e8c\u4e2a\u53ca\u4ee5\u540e\u53c2\u6570&#xff09;\u8ba9\u7ba1\u9053\u66f4\u7075\u6d3b&#xff08;\u5982\u652f\u6301\u591a\u8bed\u8a00\u3001\u591a\u683c\u5f0f&#xff09;&#xff1b;<\/li>\n<li>\u6a21\u5757\u5316\u7ba1\u7406&#xff1a;\u5c06\u7ba1\u9053\u6309\u4e1a\u52a1\u57df\u5206\u7c7b&#xff08;\u5982pipes\/order\u3001pipes\/user&#xff09;&#xff0c;\u4fbf\u4e8e\u7ef4\u62a4\u548c\u5bfc\u5165\u3002<\/li>\n<\/ul>\n<h4>3. \u5355\u5143\u6d4b\u8bd5\u793a\u4f8b<\/h4>\n<p>\u81ea\u5b9a\u4e49\u7ba1\u9053\u7684\u6d4b\u8bd5\u805a\u7126transform\u65b9\u6cd5&#xff0c;\u4ee5\u8ba2\u5355\u72b6\u6001\u7ba1\u9053\u4e3a\u4f8b&#xff1a;<\/p>\n<p>\/\/ src\/app\/pipes\/order-status\/order-status.pipe.spec.ts<br \/>\nimport { OrderStatusPipe } from &#039;.\/order-status.pipe&#039;;<\/p>\n<p>describe(&#039;OrderStatusPipe&#039;, () &#061;&gt; {<br \/>\n  let pipe: OrderStatusPipe;<\/p>\n<p>  beforeEach(() &#061;&gt; {<br \/>\n    pipe &#061; new OrderStatusPipe();<br \/>\n  });<\/p>\n<p>  it(&#039;\u8f6c\u6362\u6709\u6548\u72b6\u6001\u7801\u4e3a\u6807\u7b7e&#039;, () &#061;&gt; {<br \/>\n    expect(pipe.transform(0)).toBe(&#039;\u5f85\u652f\u4ed8&#039;);<br \/>\n    expect(pipe.transform(1)).toBe(&#039;\u5df2\u652f\u4ed8&#039;);<br \/>\n  });<\/p>\n<p>  it(&#039;\u8f6c\u6362\u6709\u6548\u72b6\u6001\u7801\u4e3a\u6837\u5f0f\u7c7b&#039;, () &#061;&gt; {<br \/>\n    expect(pipe.transform(2, &#039;class&#039;)).toBe(&#039;text-danger&#039;);<br \/>\n  });<\/p>\n<p>  it(&#039;\u5904\u7406\u65e0\u6548\u72b6\u6001\u7801&#039;, () &#061;&gt; {<br \/>\n    expect(pipe.transform(999)).toBe(&#039;\u672a\u77e5\u72b6\u6001&#039;);<br \/>\n    expect(pipe.transform(null, &#039;all&#039;)).toEqual({ label: &#039;\u672a\u77e5\u72b6\u6001&#039;, class: &#039;text-default&#039; });<br \/>\n  });<br \/>\n});<\/p>\n<h3>\u56db\u3001\u603b\u7ed3<\/h3>\n<p>\u81ea\u5b9a\u4e49\u7ba1\u9053\u662f Angular \u4e2d\u5c01\u88c5\u6570\u636e\u683c\u5f0f\u5316\u903b\u8f91\u7684\u6700\u4f73\u65b9\u5f0f&#xff0c;\u6838\u5fc3\u8981\u70b9\u5982\u4e0b&#xff1a;<\/p>\n<li>\u7eaf\u7ba1\u9053 vs \u975e\u7eaf\u7ba1\u9053&#xff1a;\u7eaf\u7ba1\u9053\u6027\u80fd\u4f18&#xff0c;\u9002\u7528\u4e8e\u8f93\u5165\u5f15\u7528\u53d8\u5316\u7684\u573a\u666f&#xff1b;\u975e\u7eaf\u7ba1\u9053\u5b9e\u65f6\u6027\u5f3a&#xff0c;\u9700\u6ce8\u610f\u6027\u80fd\u635f\u8017&#xff1b;<\/li>\n<li>\u6838\u5fc3\u903b\u8f91&#xff1a;\u901a\u8fc7transform\u65b9\u6cd5\u63a5\u6536\u8f93\u5165\u548c\u53c2\u6570&#xff0c;\u8fd4\u56de\u683c\u5f0f\u5316\u7ed3\u679c&#xff0c;\u52a1\u5fc5\u505a\u597d\u8fb9\u754c\u5904\u7406&#xff1b;<\/li>\n<li>\u4e1a\u52a1\u4ef7\u503c&#xff1a;\u5c06\u6a21\u677f\u4e2d\u7684\u590d\u6742\u903b\u8f91\u62bd\u79bb&#xff0c;\u63d0\u5347\u4ee3\u7801\u590d\u7528\u6027\u3001\u53ef\u6d4b\u8bd5\u6027&#xff0c;\u8ba9\u7ec4\u4ef6\u805a\u7126\u6838\u5fc3\u4e1a\u52a1\u3002<\/li>\n<p>\u5408\u7406\u4f7f\u7528\u81ea\u5b9a\u4e49\u7ba1\u9053&#xff0c;\u80fd\u8ba9\u4f60\u7684 Angular \u4ee3\u7801\u66f4\u7b80\u6d01\u3001\u66f4\u6613\u7ef4\u62a4&#xff0c;\u5c24\u5176\u5728\u4e2d\u5927\u578b\u9879\u76ee\u4e2d&#xff0c;\u7ba1\u9053\u7684\u590d\u7528\u4f18\u52bf\u4f1a\u66f4\u52a0\u660e\u663e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Angular \u5f00\u53d1\u4e2d&#xff0c;\u7ba1\u9053&#xff08;Pipe&#xff09;\u662f\u5904\u7406\u6570\u636e\u683c\u5f0f\u5316\u7684\u6838\u5fc3\u5de5\u5177&#xff0c;Angular \u5185\u7f6e\u7684date\u3001uppercase\u3001currency\u7b49\u7ba1\u9053\u80fd\u6ee1\u8db3\u57fa\u7840\u9700\u6c42&#xff0c;\u4f46\u9762\u5bf9\u590d\u6742\u7684\u4e1a\u52a1\u573a\u666f&#xff08;\u5982\u591a\u7ef4\u5ea6\u6570\u636e\u8f6c\u6362\u3001\u72b6\u6001\u6620\u5c04\u3001\u4e2a\u6027\u5316\u683c\u5f0f\u5316&#xff09;&#xff0c;\u81ea\u5b9a\u4e49\u7ba1\u9053\u6210\u4e3a\u63d0\u5347\u4ee3\u7801\u590d\u7528\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u7684\u5173\u952e\u3002\u672c\u6587\u5c06\u4ece\u5b9e\u9645\u4e1a\u52a1\u573a\u666f\u51fa\u53d1&#xff0c;\u8be6\u89e3\u5982\u4f55\u901a\u8fc7\u81ea\u5b9a\u4e49\u7ba1\u9053\u5c01\u88c5\u590d\u6742\u903b\u8f91&#xff0c;\u8ba9\u6a21<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5120,187,87],"topic":[],"class_list":["post-61507","post","type-post","status-publish","format-standard","hentry","category-server","tag-angular-js","tag-javascript","tag-87"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Angular\u7efc\u5408\u5e94\u752803\uff0c\u73a9\u8f6c Angular \u81ea\u5b9a\u4e49\u7ba1\u9053\uff1a\u5c01\u88c5\u590d\u6742\u6570\u636e\u683c\u5f0f\u5316\u4e0e\u4e1a\u52a1\u903b\u8f91 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/61507.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Angular\u7efc\u5408\u5e94\u752803\uff0c\u73a9\u8f6c Angular \u81ea\u5b9a\u4e49\u7ba1\u9053\uff1a\u5c01\u88c5\u590d\u6742\u6570\u636e\u683c\u5f0f\u5316\u4e0e\u4e1a\u52a1\u903b\u8f91 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5728 Angular \u5f00\u53d1\u4e2d&#xff0c;\u7ba1\u9053&#xff08;Pipe&#xff09;\u662f\u5904\u7406\u6570\u636e\u683c\u5f0f\u5316\u7684\u6838\u5fc3\u5de5\u5177&#xff0c;Angular \u5185\u7f6e\u7684date\u3001uppercase\u3001currency\u7b49\u7ba1\u9053\u80fd\u6ee1\u8db3\u57fa\u7840\u9700\u6c42&#xff0c;\u4f46\u9762\u5bf9\u590d\u6742\u7684\u4e1a\u52a1\u573a\u666f&#xff08;\u5982\u591a\u7ef4\u5ea6\u6570\u636e\u8f6c\u6362\u3001\u72b6\u6001\u6620\u5c04\u3001\u4e2a\u6027\u5316\u683c\u5f0f\u5316&#xff09;&#xff0c;\u81ea\u5b9a\u4e49\u7ba1\u9053\u6210\u4e3a\u63d0\u5347\u4ee3\u7801\u590d\u7528\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u7684\u5173\u952e\u3002\u672c\u6587\u5c06\u4ece\u5b9e\u9645\u4e1a\u52a1\u573a\u666f\u51fa\u53d1&#xff0c;\u8be6\u89e3\u5982\u4f55\u901a\u8fc7\u81ea\u5b9a\u4e49\u7ba1\u9053\u5c01\u88c5\u590d\u6742\u903b\u8f91&#xff0c;\u8ba9\u6a21\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/61507.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-17T13:49:33+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/61507.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/61507.html\",\"name\":\"Angular\u7efc\u5408\u5e94\u752803\uff0c\u73a9\u8f6c Angular \u81ea\u5b9a\u4e49\u7ba1\u9053\uff1a\u5c01\u88c5\u590d\u6742\u6570\u636e\u683c\u5f0f\u5316\u4e0e\u4e1a\u52a1\u903b\u8f91 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-17T13:49:33+00:00\",\"dateModified\":\"2026-01-17T13:49:33+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/61507.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/61507.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/61507.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Angular\u7efc\u5408\u5e94\u752803\uff0c\u73a9\u8f6c Angular \u81ea\u5b9a\u4e49\u7ba1\u9053\uff1a\u5c01\u88c5\u590d\u6742\u6570\u636e\u683c\u5f0f\u5316\u4e0e\u4e1a\u52a1\u903b\u8f91\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Angular\u7efc\u5408\u5e94\u752803\uff0c\u73a9\u8f6c Angular \u81ea\u5b9a\u4e49\u7ba1\u9053\uff1a\u5c01\u88c5\u590d\u6742\u6570\u636e\u683c\u5f0f\u5316\u4e0e\u4e1a\u52a1\u903b\u8f91 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/61507.html","og_locale":"zh_CN","og_type":"article","og_title":"Angular\u7efc\u5408\u5e94\u752803\uff0c\u73a9\u8f6c Angular \u81ea\u5b9a\u4e49\u7ba1\u9053\uff1a\u5c01\u88c5\u590d\u6742\u6570\u636e\u683c\u5f0f\u5316\u4e0e\u4e1a\u52a1\u903b\u8f91 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5728 Angular \u5f00\u53d1\u4e2d&#xff0c;\u7ba1\u9053&#xff08;Pipe&#xff09;\u662f\u5904\u7406\u6570\u636e\u683c\u5f0f\u5316\u7684\u6838\u5fc3\u5de5\u5177&#xff0c;Angular \u5185\u7f6e\u7684date\u3001uppercase\u3001currency\u7b49\u7ba1\u9053\u80fd\u6ee1\u8db3\u57fa\u7840\u9700\u6c42&#xff0c;\u4f46\u9762\u5bf9\u590d\u6742\u7684\u4e1a\u52a1\u573a\u666f&#xff08;\u5982\u591a\u7ef4\u5ea6\u6570\u636e\u8f6c\u6362\u3001\u72b6\u6001\u6620\u5c04\u3001\u4e2a\u6027\u5316\u683c\u5f0f\u5316&#xff09;&#xff0c;\u81ea\u5b9a\u4e49\u7ba1\u9053\u6210\u4e3a\u63d0\u5347\u4ee3\u7801\u590d\u7528\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u7684\u5173\u952e\u3002\u672c\u6587\u5c06\u4ece\u5b9e\u9645\u4e1a\u52a1\u573a\u666f\u51fa\u53d1&#xff0c;\u8be6\u89e3\u5982\u4f55\u901a\u8fc7\u81ea\u5b9a\u4e49\u7ba1\u9053\u5c01\u88c5\u590d\u6742\u903b\u8f91&#xff0c;\u8ba9\u6a21","og_url":"https:\/\/www.wsisp.com\/helps\/61507.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-17T13:49:33+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/61507.html","url":"https:\/\/www.wsisp.com\/helps\/61507.html","name":"Angular\u7efc\u5408\u5e94\u752803\uff0c\u73a9\u8f6c Angular \u81ea\u5b9a\u4e49\u7ba1\u9053\uff1a\u5c01\u88c5\u590d\u6742\u6570\u636e\u683c\u5f0f\u5316\u4e0e\u4e1a\u52a1\u903b\u8f91 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-17T13:49:33+00:00","dateModified":"2026-01-17T13:49:33+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/61507.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/61507.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/61507.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Angular\u7efc\u5408\u5e94\u752803\uff0c\u73a9\u8f6c Angular \u81ea\u5b9a\u4e49\u7ba1\u9053\uff1a\u5c01\u88c5\u590d\u6742\u6570\u636e\u683c\u5f0f\u5316\u4e0e\u4e1a\u52a1\u903b\u8f91"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/61507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=61507"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/61507\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=61507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=61507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=61507"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=61507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}