Angular2项目日常开发中所遇问题及解决方案记录(一)

Angular2项目日常开发中所遇问题及解决方案记录(一)

96 
易sense 
2016.09.27 11:30*  字数 382  阅读 11443 评论 8 赞赏 4

最近在把一个angularjs1.4版本的项目使用angular2框架进行升级,因此也把个人每天开发中遇到的问题及解放方案记录下来,不定时更新~

1、Webstorm can't find '@angular/core';

解决方案:

In webstorm : 
File->settings->Languages & Frameworks -> TypeScript ->enable typescript compiler & Use tsconfig.json

2、/localhost:3000/node_modules/rxjs.js 报错 404

Change your rxjs entry in package to this:

'rxjs': {
main: '/bundles/Rx.umd.js',
defaultExtension: 'js'
}

3、of.js和from.js、fromPromise.js 找不到 报错404

仔细查看之后发现:rxjs-5.0.0-beta.11与rxjs-5.0.0-beta.2下面的observable包里的目录结构不一致。

4、在Component中注入管道(pipe)时报错:can't find pipe~



在stackoverflow中查到解决方案:
http://stackoverflow.com/questions/39539085/angular-2-0-release-pipes-and-directives-are-not-properties-of-component-anymo


5、*ngFor指令不支持键值对结构?

解决方案:http://stackoverflow.com/questions/37046138/how-to-use-ngfor-with-object

6、No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.

解决方案: add <basehref='/'>

7、Error: Uncaught (in promise): Error: Cannot match any routes: ''"

解决方案:


8、Can't bind to 'ngModel' since it isn't a known property of 'input'?

解决方案:In order to be able to use two-way data binding for form inputs you need to import theFormsModulepackage in your Angular module. For more info see the Angular 2 official tutorial here and the official documentation for forms

9、http post请求 response里面找不到headers?

解决方案:可以把map方法去了试试。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值