我最近将角度4升级到6.现在我尝试了下面的命令
ng generate service security/security
Run Code Online (Sandbox Code Playgroud)
但它在"e2e/app"文件夹下创建了服务,而不是在"src/app"下面是我的angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"xyz": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/favicon.ico"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/style.scss",
"src/styles.css"
],
"scripts": [
]
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [ …Run Code Online (Sandbox Code Playgroud)class X {
sealed protected virtual void F() {
Console.WriteLine("X.F");
}
sealed void F1();
protected virtual void F2() {
Console.WriteLine("X.F2");
}
}
Run Code Online (Sandbox Code Playgroud)
在上面的代码中有编译时错误:
XF()'不能密封,因为它不是替代
X.F1()'无法密封,因为它不是替代
这是否意味着我们只能使用sealed必须覆盖某些方法的关键字whey?