From 5108d9ef3a5338d0e06cc0be4961d208921a4eeb Mon Sep 17 00:00:00 2001 From: olafvanv Date: Wed, 10 Jul 2024 12:05:28 +0200 Subject: [PATCH 1/3] Snippet for Angular Standalone Component --- src/snippets.json | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/snippets.json b/src/snippets.json index 52ac8e9..b12596b 100644 --- a/src/snippets.json +++ b/src/snippets.json @@ -165,6 +165,28 @@ "$0" ] }, + "Angular Component Standalone": { + "prefix": "ng-component-standalone", + "description": "Standalone component with template and style urls", + "types": "typescript", + "body": [ + "import { Component, OnInit } from '@angular/core';", + "", + "@Component({", + "\tselector: '${1:app}-${2:name}',", + "\ttemplate: `${3}`,", + "\tstyles: [`${4}`]", + "\tstandalone: true", + "\timports: []", + "})", + "export class ${5:Name}Component implements OnInit {", + "\tconstructor($6) { }", + "", + "\tngOnInit() {${7: }}", + "}", + "$0" + ] + }, "Angular Component With NG_VALUE_ACCESSOR": { "prefix": "ng-component-value-accessor", "description": "Angular Component With NG_VALUE_ACCESSOR", From 5aa9119ba088cc339467a5b3b1259ca59fd05966 Mon Sep 17 00:00:00 2001 From: olafvanv Date: Wed, 10 Jul 2024 12:14:06 +0200 Subject: [PATCH 2/3] missing comma's added + standalone pipe support --- src/snippets.json | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/snippets.json b/src/snippets.json index b12596b..764eb27 100644 --- a/src/snippets.json +++ b/src/snippets.json @@ -175,8 +175,8 @@ "@Component({", "\tselector: '${1:app}-${2:name}',", "\ttemplate: `${3}`,", - "\tstyles: [`${4}`]", - "\tstandalone: true", + "\tstyles: [`${4}`],", + "\tstandalone: true,", "\timports: []", "})", "export class ${5:Name}Component implements OnInit {", @@ -548,6 +548,24 @@ "}" ] }, + "Angular Pipe Standalone": { + "prefix": "ng-pipe-stanndalone", + "description": "Standalone pipe template", + "types": "typescript", + "body": [ + "import { Pipe, PipeTransform } from '@angular/core';", + "", + "@Pipe({", + "\tname: '${name}',", + "\tstandalone: true", + "})", + "export class ${Name}Pipe implements PipeTransform {", + "\ttransform(value: any): any {", + "\t\t$0", + "\t}", + "}" + ] + }, "Angular Pipe Example": { "prefix": "ng-pipe-example", "description": "Angular pipe example", From c277ffe5df6523a4dfb12ca1d41f7571ebae7560 Mon Sep 17 00:00:00 2001 From: olafvanv Date: Wed, 10 Jul 2024 12:15:10 +0200 Subject: [PATCH 3/3] typo fix --- src/snippets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/snippets.json b/src/snippets.json index 764eb27..122bb5a 100644 --- a/src/snippets.json +++ b/src/snippets.json @@ -549,7 +549,7 @@ ] }, "Angular Pipe Standalone": { - "prefix": "ng-pipe-stanndalone", + "prefix": "ng-pipe-standalone", "description": "Standalone pipe template", "types": "typescript", "body": [