I wrote this snippet and I'm looking for a way to edit the import line at the head of the file and add the correct additions to Component class.
"Angular Lifecycle Hooks": {
"prefix": "nglifecycle",
"body": [
"ngOnChanges() {",
"\t// called before any bindings are made and before ngOnInit()",
"\t// Here you can access the change detection results, and make any updates you want.",
"\tconsole.log('ngOnChanges');",
"}",
"",
"ngOnInit() {",
"\t// called once after the first ngOnChanges()",
"\tconsole.log('ngOnInit');",
"}",
""
],
"description": "Angular Lifecycle Hooks Snippet"
}
Is there a way to do so?
Example for what I'm trying to achieve:
The snippet generate the text in the body tag, let's say use it in line number 15. And I have this line, near the top of the file
import {Component} from '@angular/core'
I'm looking for a way that the snippet will update that line to
import {Component, OnInit, OnChange} from '@angular/core'
You see it is adding OnInit and OnChange which were added in the snippet body as ngOnChnages() and ngOnInit().
