import { Component } from '@angular/core'; @Component({ selector: 'show-errors', template: `<div></div>`, }) export class ShowErrorsComponent { private static readonly errorMessages = { 'required': () => 'This field is required', 'minlength': (params) => 'The min number of characters is ' + params.requiredLength, 'maxlength': (params) => 'The max allowed number of characters is ' + params.requiredLength, 'pattern': (params) => 'The required pattern is: ' + params.requiredPattern, 'years': (params) => params.message }; private getMessage(type: string, params: any) { return ShowErrorsComponent.errorMessages[type](params); } }
08 November 2018
Sử dụng từ khóa Static và Readonly trong Angular 2
Related Posts:
Converting Files To Base64 In Angular 2+ Converting Files To Base64 In Angular 2+Stackblitz | Stackblitzapp.component.htmlAngular 2+ 2021<div> <button class="btn" (click)="file.click()">Tải ảnh lên</button>… Read More
Download CSV Shift-JIS SJIS Angular 2+ export-csv-ecl.html Javascript <!doctype html> <html> <head> <script src="ecl_array.js"></script> <script> function download_csv() { var conte… Read More
Complete Angular Tutorial For Beginners What is AngularThe Angular is a development platform for building a Single Page Application for mobile and desktop. It uses Typescript & HTML to build Apps. The Angular itself is written using the Typescript. It now… Read More
Bundle CSS Angular 2+ angular.json2021"build": { "builder": "@angular-devkit/build-angular:browser", "options": { "styles": [ { "input": "src/style/dark/dark.scss", … Read More
Setting Proxy Web IIS - Reverse Proxy IIS with Agnular 2 - Proxy chuyển hướng đến 2 địa chỉ IP khác nhau - (IIS rewrite rules configuration for Angular 2+)Lưu lại nhưng gì đã cài đặt phía trên để tự động cài đặt IISCài đặt môi trường web server test IIS: referLưu ý rằng để hiển thị chức năng URL rewrite bạn cần phải download và install: downloadMở chức năng IIS và Add… Read More
0 nhận xét:
Post a Comment