Async pipe not working with Subject

后端 未结 2 1408
终归单人心
终归单人心 2021-02-14 16:46

I have the following BehaviorSubject in a service:

  isAuthenticated = new BehaviorSubject(false);

And I am using it as follows

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-14 17:17

    I thought of posting a solution using ng-if-else which is maybe even more intuitive in your particular case:

    
    
      Log in
    
    

    Alternatively you could puth both cases inside a ng-template:

    
    Logged in
    Log in
    

    Hope it is of any use to other people ending up here.

提交回复
热议问题