我按照" https://angular.io/guide/service-worker-getting-started "中的说法完成了我的应用程序PWA.
正是使用了这个命令:
ng add @angular/pwa
npm install http-server -g
ng build --prod
http-server -p 8080 -c-1 dist
Run Code Online (Sandbox Code Playgroud)
然后我在Chrome上打开了这个网址(隐身)
当我为开发人员打开工具(f12)>应用程序>服务工作者时,没有可用的服务工作者,当我在那里设置离线时,网站不起作用.
有关我的角应用的其他信息:
package.json :(最重要的)
"@angular/core": "^7.0.2",
"@angular/pwa": "^0.10.6",
"@angular/service-worker": "^7.0.4",
"@angular-devkit/build-angular": "^0.10.6",
"@angular/cli": "^7.0.6",
Run Code Online (Sandbox Code Playgroud) service-worker progressive-web-apps angular-cli angular angular7
我已经创建了angular 7应用程序,现在我正尝试向它添加angular通用程序。因此,我遵循了以下步骤:
https://angular.io/guide/universal
在终端中输入以下内容:
ng add @nguniversal/express-engine --clientProject resume-app
Run Code Online (Sandbox Code Playgroud)
然后我这样写:
npm run build:ssr && npm run serve:ssr
Run Code Online (Sandbox Code Playgroud)
它不起作用,终端返回了很多错误:
错误:无法解析/Users/tomaszzmudzinski/Documents/Projects/Resume/resume-app/src/app/components/home/home.component.ts中的HomeComponent的所有参数:(?,?)。src / app / components / home / home.component.ts(2,24):错误TS2307:找不到模块“ src / app / models / Resume”。src / app / components / home / home.component.ts(3,31):错误TS2307:找不到模块“ src / app / services / resume.service”。src / app / components / home / home.component.ts(4,44):错误TS2307:找不到模块“ src / app / models / GetBasicStatisticsResponse”。src / app / components / home / home.component.ts(5,35):错误TS2307:找不到模块“ src / app / services / statistics.service”。src / …