Angularjs
发布时间:2022-04-20 发布网站:大佬教程 code.js-code.com
大佬教程收集整理的这篇文章主要介绍了angular2项目教程-微型Blog系统2,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
Route,Module,Component
静态路由
path:"echart",
component:ChartComponent
}
这样配置,依赖的组件全打包,会很大。
异步路由,就不会
loadChildren
——————————
架构思想
组件化,依赖注入,数据绑定
————————————————
双大括号和[(ngModel)]值绑定,()事件绑定
——————————————————————
组件间通讯
共享组件
给子组件传参数。
SELEctor: 'app-user-info',
templateUrl: './user-info.component.html',
styleUrls: ['./user-info.component.scss']
})
export class UserInfoComponent implements OnInit
{
}
根据不同的场景,传递进来
文章详情<app-user-info panel
title="作者信息" (follow)="doFollow()"></app-user-info>
后台用户信息<app-user-info panel
title="
用户信息" (follow)="doFollow()"></app-user-info>
——————————————————————————————
给父组件传值:
@Output()
public follow = new EventEmitter<
String>(
);
父组件的<app-user-info panel
title="作者信息" (follow)="doFollow()"></app-user-info>中的(follow)="doFollow()"
}
——————————————————————————
不仅被注入到‘
用户登录’组件,还被注入到post-detail-main.component.ts,UserLogin
service是同
一个实例
thi
s.subscription=thi
S.UserLogin
service.currentUser
public get currentUser():Observable<User>
{
return thi
s.sub
ject.asObservable(
);
}
————————————————————————————————
生命周期钩子
ngOnInit //组件初始化完成之后,panel
title才会有值
export class
BooleanPipe implements PipeTransform
{
大佬总结
以上是大佬教程为你收集整理的angular2项目教程-微型Blog系统2全部内容,希望文章能够帮你解决angular2项目教程-微型Blog系统2所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。