あなたがに変更したいとし、2つのファイルtslint.jsonと.angular-cli.jsonを変更する必要がmyprefix:
tslint.jsonファイルで、次の2つの属性を変更するだけです。
"directive-selector": [true, "attribute", "app", "camelCase"],
"component-selector": [true, "element", "app", "kebab-case"],
「app」を「myprefix」に変更します
"directive-selector": [true, "attribute", "myprefix", "camelCase"],
"component-selector": [true, "element", "myprefix", "kebab-case"],
angular.jsonファイルで、属性プレフィックスを変更するだけです
(6未満の角度バージョンの場合、ファイル名は.angular-cli.jsonです)。
"app": [
...
"prefix": "app",
...
「app」を「myprefix」に変更します
"app": [
...
"prefix": "myprefix",
...
@Salil Juniorが指摘するように、複数のプレフィックスが必要な場合:
"component-selector": [true, "element", ["myprefix1", "myprefix2"], "kebab-case"],
Angular CLIを使用して新しいプロジェクトを作成する場合は、このコマンドラインオプションを使用します
ng new project-name --prefix myprefix
ng generate component
としても更新後tslint.json
:You are using different prefix from app, you might get lint errors. Please update "tslint.json" accordingly.
私は更新しなければならなかったapps.prefix
にプロパティを.angular-cli.json
その警告を取り除くために。