我正在使用php开发一个web api(服务)项目。现在我想向它添加一个Angular客户端,但是在同一项目目录下。所以我用命令ng new my-php-app-name
添加了它,并在我的php应用程序的同一目录中生成它。正如我已经想到的那样,每次我想从角度得到结果时,我应该通过npm start
(继续编译)或ng build
来构建它一次。所以现在当我使用npm start
时,应用程序在端口4200中启动并正常工作。
如何在php页面中包含该angular应用程序的主页面。我测试过包括“src / index.html”,但它没有用。
值得一提的是,角项目是使用this tutorial创建的。
项目树如下:
.
├── ~
├── client_app
├── composer.json
├── composer.lock
├── composer.phar
├── config
│ └── cli-config.php
├── controllers
│ ├── account_controller.php
│ ├── home_controller.php
│ └── unitapi_controller.php
├── e2e
│ ├── app.e2e-spec.ts
│ ├── app.po.ts
│ └── tsconfig.e2e.json
├── helpers
│ ├── HASHHELPER.php
│ ├── rb.php
│ ├── STRINGHELPER.php
│ └── URLHELPER.php
├── index.php
├── karma.conf.js
├── models
│ ├── bootstrap.php
│ ├── entities
│ │ ├── additional_field.php
│ │ ├── additional_value.php
│ │ ├── good_request.php
│ │ ├── unit.php
│ │ └── user.php
│ └── viewmodels
│ └── unit_list_viewmodel.php
├── node_modules
│ ├── ...
├── package.json
├── package-lock.json
├── protractor.conf.js
├── README.md
├── routes.php
├── services
│ ├── account_service.php
│ └── unit_service.php
├── src
│ ├── app
│ │ ├── app.component.css
│ │ ├── app.component.html
│ │ ├── app.component.spec.ts
│ │ ├── app.component.ts
│ │ └── app.module.ts
│ ├── assets
│ ├── environments
│ │ ├── environment.prod.ts
│ │ └── environment.ts
│ ├── favicon.ico
│ ├── index.html
│ ├── main.ts
│ ├── polyfills.ts
│ ├── styles.css
│ ├── test.ts
│ ├── tsconfig.app.json
│ ├── tsconfig.spec.json
│ └── typings.d.ts
├── tests
│ ├── add_user.php
│ ├── entity_manager_type.php
│ ├── get_user.php
│ └── sample_query.php
├── tree.txt
├── tsconfig.json
├── tslint.json
├── UsefulCommands.txt
├── vendor
│ ├── ...
└── views
├── account
│ └── login.php
├── home
│ └── index.php
├── layout.php
└── shared
└── error.php
3511 directories, 22335 files