
Angular学习
lionheart922
这个作者很懒,什么都没留下…
展开
-
Angular 中 ng-container的用法
<p> I turned the corner <ng-container *ngIf="hero"> and saw {{hero.name}}. I waved </ng-container> and continued on my way.</p>当然这里 ng-container可以用div替换, 但是 替换后 html的结构就不一样了。...原创 2021-11-25 15:24:44 · 782 阅读 · 0 评论 -
Angular中 ng-template 的用法
<div *ngIf="canEdit; else noEdit"> <p>You can edit the following paragraph.</p></div><ng-template #noEdit> <p>The following paragraph is read only. Try clicking the button!</p></ng-template>原创 2021-11-23 13:35:30 · 811 阅读 · 0 评论 -
在angular 中使用 npm link
需求是,需要在本地创建一个 angular 的 library,作为公共模块, 然后在其他application中引用它创建angular公共libraryng new my-workspace --create-application=falsecd my-workspaceng generate library my-lib在common library 的项目里的package.json里需要在dependencies引用第三方包的情况下必须在, ng-package.json里加白名原创 2021-01-15 10:16:14 · 635 阅读 · 0 评论 -
从angular里传值Auth Api
问题是Auth api不接受json格式的 form post, 这种情况下 Http Header里的Content-Type必须是'application/x-www-form-urlencoded' headers: { Authorization: token, 'Content-Type': 'application/x-www-form-urlencoded', }然后..原创 2020-05-18 16:01:36 · 218 阅读 · 0 评论 -
Angular 中的的Workspace,项目引用及debug
项目引用参照https://medium.com/@SirMaxxx/angular-6-creating-a-shareable-control-library-6a27f0ebe5c2debug参照https://developers.de/2018/09/05/angluar-library-debugging/原创 2020-01-07 18:01:17 · 342 阅读 · 0 评论 -
依赖注入不成功:Can't resolve all parameters for AppComponent
解决方法:tsconfig.json里emitDecoratorMetadata设置成true"emitDecoratorMetadata": true,改完需要重新 ng serve原创 2019-12-27 09:29:22 · 2395 阅读 · 0 评论 -
Angular 里的 BrowserModule 只能import一次
如果多次导入的话会得到:BrowserModule has already been loaded Error的错误,在工作中遇到的实际的case, 当导入一个npm包后,运行angular发现这个错误,如果将这个包里export的module从root module import, 不会报错,但是,当我使用lazy load,在业务模块中导入的时候就会报错了,解决放案1. 当我们自制...原创 2019-12-12 13:51:25 · 1028 阅读 · 0 评论 -
如何将Angular-cli的版本更新到最新
更新global 的angular -cli的版本 npm uninstall -g angular-clinpm cache clean or npm cache verify #(if npm > 5)npm install -g @angular/cli@latest 更新本地angular project的版本 rm -rf node_modules...原创 2019-09-24 16:43:54 · 591 阅读 · 0 评论