Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular Nativescript:组件拆分导致无法读取属性中出错';0';未定义的_Angular_Nativescript_Angular2 Nativescript - Fatal编程技术网

Angular Nativescript:组件拆分导致无法读取属性中出错';0';未定义的

Angular Nativescript:组件拆分导致无法读取属性中出错';0';未定义的,angular,nativescript,angular2-nativescript,Angular,Nativescript,Angular2 Nativescript,我有一个LoginComponent,我想为web和mobile拆分它。一旦我克隆并创建login.component.tns.ts并运行tns build android--bundle,我就会遇到以下错误 Entrypoint bundle = runtime.js vendor.js bundle.js [./app.css] 1.2 KiB {bundle} [built] [./main.tns.ts] 1.13 KiB {bundle} [built] [~/package.json

我有一个LoginComponent,我想为web和mobile拆分它。一旦我克隆并创建login.component.tns.ts并运行tns build android--bundle,我就会遇到以下错误

Entrypoint bundle = runtime.js vendor.js bundle.js
[./app.css] 1.2 KiB {bundle} [built]
[./main.tns.ts] 1.13 KiB {bundle} [built]
[~/package.json] external "~/package.json" 42 bytes {bundle} [optional] [built]
    + 327 hidden modules

ERROR in Cannot read property '0' of undefined
Webpack compilation complete.
Executing webpack failed with exit code 2.
如果删除login.component.tns.ts文件,构建工作正常。这里有什么指示吗

app/tsconfig.app.json

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "types": [
      "node"
    ],
    "paths": {
      "@src/*": [
        "src/*.web",
        "src/*"
      ]
    }
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ],
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ]
}
tsconfig.tns.json(不在应用程序文件夹内,但在项目文件夹内)

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "module": "ESNext",
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "baseUrl": ".",
    "paths": {
      "@src/*": [
        "src/*.tns.ts",
        "src/*.ts"
      ]
    }
  },
  "files": [
    "src/main.tns.ts"
  ]
}