{"id":15953816,"url":"https://github.com/yasu-s/ng-ie11-number-sample","last_synced_at":"2026-04-26T12:32:19.505Z","repository":{"id":149598117,"uuid":"148743167","full_name":"yasu-s/ng-ie11-number-sample","owner":"yasu-s","description":"Angular IE11 number directive sample","archived":false,"fork":false,"pushed_at":"2018-10-01T12:30:13.000Z","size":102,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T05:41:54.349Z","etag":null,"topics":["angular","directive","ie11"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yasu-s.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-14T06:07:18.000Z","updated_at":"2019-07-16T14:55:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"01e2386b-7594-44da-b053-3ed6a0897b61","html_url":"https://github.com/yasu-s/ng-ie11-number-sample","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/yasu-s/ng-ie11-number-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasu-s%2Fng-ie11-number-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasu-s%2Fng-ie11-number-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasu-s%2Fng-ie11-number-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasu-s%2Fng-ie11-number-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yasu-s","download_url":"https://codeload.github.com/yasu-s/ng-ie11-number-sample/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasu-s%2Fng-ie11-number-sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32297893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T09:34:17.070Z","status":"ssl_error","status_checked_at":"2026-04-26T09:34:00.993Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","directive","ie11"],"created_at":"2024-10-07T13:14:09.184Z","updated_at":"2026-04-26T12:32:19.490Z","avatar_url":"https://github.com/yasu-s.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview  \n\nThis is a sample number input directive compatible with IE11.\n\n# System requirements\n\n* Node.js 8.9.x\n* TypeScript 2.9.x\n* Angular 6.1.x\n\n# Operation check  \n\n## 1. Download Sample\n\n```\ngit clone git@github.com:yasu-s/ng-ie11-number-sample.git\n```\n\n## 2. Installing packages  \n\n```\ncd ng-ie11-number-sample\nnpm install\n```\n\n## 3. Launch sample application  \n\n```\nnpm start\n```\n\n## 4. Execution result  \n\n![ie11](https://user-images.githubusercontent.com/2668146/45686245-e19d6300-bb86-11e8-8248-76656edac24f.gif)\n\n# Sample source\n\n## src/app/custom-number.directive.ts\n\n```typescript\nimport { Directive, ElementRef, HostListener } from '@angular/core';\n\n@Directive({\n  selector: 'input[customNumber]'\n})\nexport class CustomNumberDirective {\n\n  /** input */\n  private inputElement: HTMLInputElement;\n\n  /**\n   * CustomNumberDirective \n   * @param elementRef\n   */\n  constructor(private elementRef: ElementRef) {\n    if (!this.elementRef || !this.elementRef.nativeElement) return;\n    this.inputElement = \u003cHTMLInputElement\u003ethis.elementRef.nativeElement;\n  }\n\n  /**\n   * Enter numerical value only.\n   * @param event KeyboardEvent\n   */\n  @HostListener('keypress', ['$event'])\n  onKeyPress(event: KeyboardEvent) {\n    if (!/^\\d*$/.test(event.key))\n      event.preventDefault();\n  }\n\n  /**\n   * Convert to numerical value when focus is off.\n   */\n  @HostListener('blur')\n  onBlur(): void {\n    if (!this.inputElement) return;\n    const value = this.inputElement.value;\n    if (value === null || value === '') return;\n\n    const num = Number(value);\n\n    if (!isNaN(num))\n      this.inputElement.value = num.toString();\n  }\n\n}\n```\n\n## src/app/app.component.ts\n\n```typescript\n@Component({\n  selector: 'app-root',\n  template: `\n    \u003ch2\u003eIE11 Number Directive Sample\u003c/h2\u003e\n    \u003cdiv\u003e\n      \u003cul\u003e\n        \u003cli\u003etype=text:\u003cinput type=\"text\" [(ngModel)]=\"text1\"\u003e - {{ text1 }}\u003c/li\u003e\n        \u003cli\u003etype=number:\u003cinput type=\"number\" [(ngModel)]=\"num1\"\u003e - {{ num1 }}\u003c/li\u003e\n        \u003cli\u003etype=number+customNumber:\u003cinput type=\"number\" customNumber [(ngModel)]=\"num2\"\u003e - {{ num2 }}\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/div\u003e\n  `\n})\nexport class AppComponent {\n\n  text1: string;\n\n  num1: number;\n\n  num2: number;\n\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasu-s%2Fng-ie11-number-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyasu-s%2Fng-ie11-number-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasu-s%2Fng-ie11-number-sample/lists"}