Skip to content

Commit

Permalink
added some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
brianParcel committed Feb 16, 2018
1 parent 92083b5 commit ba40172
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/app/components/partials/navbar/navbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { User } from './../../../models/user.model';
selector: 'app-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
changeDetection: ChangeDetectionStrategy.OnPush,//this means it is not active checking for data changes
})
export class NavbarComponent implements OnInit {
user:User ;
Expand All @@ -18,8 +18,10 @@ export class NavbarComponent implements OnInit {
this.user = User.Auth();

User.on('auth', (auth_state)=>{
console.log('the user has:', auth_state)
this.cd.markForCheck();//this updates the data on the component
console.log('the user has:', auth_state);

//we can dynamically make the view check on cvertain events. For large apps this is very efficient
this.cd.markForCheck();//this makes the view check for updates once
this.user = User.Auth();
});

Expand Down

0 comments on commit ba40172

Please sign in to comment.