【发布时间】:2018-12-04 11:16:32
【问题描述】:
我有两个组件:
注册并登录。
在 RegisterComponent 我有锚点:
<a id="titleClient">Already have a account? Click here</a>
我需要在用户单击此锚点时将 Login 属性 already_client 设置为 true:
export class LoginComponentimplements OnInit {
already_client: boolean
...
}
我尝试输入属性,但我用来显示这个组件,我不能使用<app-logincomponent [already-client]="true">
我该怎么做?
谢谢
【问题讨论】:
-
使用 EventEmitters、Subjects 和 Observables。看看这个:stackoverflow.com/questions/51380223/…
-
我尝试: public handleSubscriptions() { this.subscription = this.registrarService.setCliente_JControle.subscribe( action => { console.log(action); } ) } 在服务中: setCliente_JControle(possui_conta: boolean ) { this.cliente_jcontrole.next({action: true}); } 但我得到:[ts] 属性 'subscribe' 在类型 '(possui_conta: boolean) => void' 上不存在。
标签: angular typescript