搭建:

标题

 ng new cloud --routing --style scss --skip-install
cd cloud/
npm i

项目可以启动。

ng g --help 
ng g c --help 

ng g c testA >test-a(所以说,最好不要用大写的)
ng g c test-A == ng g testA,
>test-a

ng g component test/test --flat 表示是否不需要创建文件夹。生成的组件不需要文件夹包裹(在模块内的组件不需要包裹的)
ng g c test/a -it --inline-template 模板是否应该放在ts文件里
--inline-style (-is) 样式是否应该放在ts文件里.

angular中ViewEncapsulation参数:https://segmentfault.com/a/1190000008677532
encapsulation: ViewEncapsulation.None // 三个参数(各有其用): None | Emulated | Native
输入下面的命令:

$ ng g c test-c --view-encapsulation

错误提示:
Schematic input does not validate against the Schema: {“viewEncapsulation”:"",“s tyleext”:“scss”,“inlineStyle”:false,“inlineTemplate”:false,“changeDetection”:“De fault”,“spec”:true,“flat”:false,“skipImport”:false,“export”:false,“entryComponen t”:false}
Errors:

Data path “.viewEncapsulation” should be equal to one of the allowed values.
说明,这个参数,没有传值,那么这么写:
ng g c test-c --view-encapsulation None (c:component,在module中声明)

$ ng g d sss2 --flat false 有自己 的文件夹(d:directive)(在app.module进行了声明.)

ng g s order-data -d (s:service,-d: --dry-run,这个参数在自己测试的时候,很有用的,因为你也不知道具体生成文件的路径)只生成了两个文件, 并没有在app.module里面注册
正确的做法是使用 -m 参数来指定需要注册的module:
ng g s order-data2 -m app (app是模块名字)
ng g s mySwe123 --spec false (这样不会生成spec文件!!!)
ng g m login 生成模块(m:module)

$ ng g c welcome -d

CREATE src/app/welcome/welcome.component.html (26 bytes)
CREATE src/app/welcome/welcome.component.spec.ts (635 bytes)
CREATE src/app/welcome/welcome.component.ts (274 bytes)
CREATE src/app/welcome/welcome.component.scss (0 bytes)
UPDATE src/app/app.module.ts (859 bytes)

NOTE: Run with “dry run” no changes were made.
说明,在module中添加了该组件,但是,我想在其他模块添加,那么用-m 参数来解决
ng g c welcome123 -m login 在login模块增加这个模块

:使用这个请缓存.... 百度统计:使用百度统计,加 js

index.html中:
1.loading…
2.增加入场动画

main.ts中:
window.console.log=function(){};
window.console.info=function(){};
window.console.warn=function(){};
window.console.error=function(){};
window.console.debug=function(){};,不要这些函数,开发的时候使用的!

入场动画怎么结束:
在src/app/theme中,有services文件夹,里面有baThemePreloader和baThemeSpinner服务,加载完成后,加载动画hide。

新建pages文件夹(能不能自己生成)

ng g m pages --routing --flat --spec false  
ng g c pages --flat  --spec false
ng g m auth --routing --spec false
angular\cloud\src\app\pages>ng g c auth/auth --spec false -m auth --flat -d

注意:-d的使用,自己层级错了太多次,需要注意了!

这时候:
core.js:1673 ERROR Error: Uncaught (in promise): Error: Cannot find module ‘app/pages/auth/auth.module’
Error: Cannot find module ‘app/pages/auth/auth.module’
at $_lazy_route_resource lazy namespace object:5
这样的错误!cli版本过高????曹

app.routing.ts中:
export const routes: Routes = [
{ path: ‘’, redirectTo: ‘gyauth’, pathMatch: ‘full’ },
{ path: ‘**’, redirectTo: ‘gyauth’ }
];
export const routing: ModuleWithProviders = RouterModule.forRoot(routes, { useHash: false });

端口号被占用,在后台程序中(进程和详情),找到node,结束任务,就可以了

npm install -g @angular/cli

npm uninstall -g @angular/cli
(win7) npm cache verify
(win10) npm cache clean 错,与版本无关!我用企业版win10,执行的verify
关闭命令窗口,重新打开
提示:bash: ng: command not found,就是卸载成功
详细介绍:https://blog.csdn.net/husong_/article/details/80210840
https://blog.csdn.net/fdsjiaoDoctor/article/details/78249530

angular 监听窗口滚动:看下这个人的博客:https://blog.csdn.net/ItTvibe/article/details/80060801

npm install -g @angular/cli@1.5.2
ng -v
报错:module.js:549
throw err;
^

Error: Cannot find module ‘@angular-devkit/core’
重新安装angular-devkit/core这个东西
https://blog.csdn.net/u011389297/article/details/80296444
https://blog.csdn.net/hbr2014/article/details/79317140

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值