有官方角度生成器,许多用户为Angular 1提供了一些.但是我还没有找到Angular 2的生成器.
这样的自然生成器是否已存在?
我尝试使用实例方法中的静态成员.我知道从typescript中的非静态函数访问静态成员,但我不想硬编码该类以允许继承:
class Logger {
protected static PREFIX = '[info]';
public log(msg: string) {
console.log(Logger.PREFIX + ' ' + msg); // What to use instead of Logger` to get the expected result?
}
}
class Warner extends Logger {
protected static PREFIX = '[warn]';
}
(new Logger).log('=> should be prefixed [info]');
(new Warner).log('=> should be prefixed [warn]');
Run Code Online (Sandbox Code Playgroud)
我尝试过类似的东西
typeof this.PREFIX
Run Code Online (Sandbox Code Playgroud) 我使用特定的模块名称创建了我的Angular应用程序,现在我决定更改它.
所以,当我这样做
yo angular:controller myController
Run Code Online (Sandbox Code Playgroud)
它创建
angular.module('MyTestModule')
Run Code Online (Sandbox Code Playgroud)
在哪里Yo
寻找这个,无论如何更新它?
谢谢