我的Jetbrains IntelliJ上已有这个实时模板,用于快速创建角度2组件:
import { Component, OnInit } from '@angular/core';
@Component({
moduleId: module.id,
selector: '$selector$',
templateUrl: '$name$.component.html'
})
export class $ComponentName$Component implements OnInit {
constructor() { }
ngOnInit() { }
$END$
}
这是我脑海中最好的解决方案。但不幸的是,我必须键入$ nameonly $,尽管该名称已经在组件名称中:
import {Component} from '@angular/core';
import {MeteorComponent} from "angular2-meteor";
import template from './$name$.html';
@Component({
selector: '$nameonly$',
template
})
export class $uppername$Component extends MeteorComponent {
constructor() {
super();
}
$END$
}