Angular2 Question List

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/my_study_everyday/article/details/84072411

问题1:ng build部署后base文件路径问题

使用angular-cli搭建的项目,执行ng build后,浏览器打开空白,发现文件的路径不对
2017-8-13

解决方案:

在package.json文件的scripts中添加命令:
"build":"ng build --base-href ./"
–base-href后面替换成打包后的base路径
执行:npm run build

问题2:PrimeNg style not working --stackoverflow

问题3: angular2项目构建后部署到Tomcat刷新页面出现404的问题

用angular2-cli打包项目之后,跳转路由刷新会报404的错误

问题4: TypeScript: Cannot read property ‘push’ of undefined in [null]

Need to initialize the array:
stringArr = [];

问题5:不能在两个模块中重复声明管道,指令,组件

Type AwesomePipe is part of the declarations of 2 modules: ContactModule and AppModule! 
Please consider moving AwesomePipe to a higher module 
that imports ContactModule and AppModule. 
You can also create a new NgModule that exports and includes AwesomePipe 
then import that NgModule in ContactModule and AppModule.

根据错误视情况而定。

ending

猜你喜欢

转载自blog.csdn.net/my_study_everyday/article/details/84072411
今日推荐