如何在一个Angular 2应用程序中创建多个NgModule和多个* .html页面

时间:2017-04-24 10:27:43

标签: angular typescript

我正在创建Angular2工资单应用程序,它有多个* .html页面(一个用于会计师,一个用于员工经理,一个用于员工自助服务),但是它们共享相同的模块以及一些相同的组件。是否可以创建具有多个* .html页面的此类Angular2应用程序?

在我进行实验时,我收到了很多错误:

index_employee.html:16 Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:8080/traceur
    Error: XHR error (404 Not Found) loading http://localhost:8080/traceur
        at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:8080/node_modules/zone.js/dist/zone.js:698:29)
        at ZoneDelegate.invokeTask (http://localhost:8080/node_modules/zone.js/dist/zone.js:265:35)
        at Zone.runTask (http://localhost:8080/node_modules/zone.js/dist/zone.js:154:47)
        at XMLHttpRequest.ZoneTask.invoke (http://localhost:8080/node_modules/zone.js/dist/zone.js:335:33)
    Error loading http://localhost:8080/traceur
    Unable to load transpiler to transpile http://localhost:8080/app/scripts/components/employeeprofile.component.js
    Error loading http://localhost:8080/app/scripts/components/employeeprofile.component.js as "./scripts/components/employeeprofile.component" from http://localhost:8080/app/employeesite.module.jsrrr(anonymous function) @ index_employee.html:16

core.umd.js:3376 Error: The selector did not match any elements 
core.umd.js:3376 Error: The selector "s5-employeeprofile" did not match any elements

我厌倦了逐一发现错误,我想知道构建此类应用程序的最佳实践:

  • 我应该在main.ts中写多个platform.bootstrapModule(EmployeeSiteModule);语句 - 每个模块一个吗?

  • 我应该为每个@NgModule创建单独的路由吗?

0 个答案:

没有答案