Guest User

Untitled

a guest
Feb 24th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. ngOnInit() {
  2.  
  3. this.data = this.apollo.query({ query: ResidentQuery }).subscribe(({data, loading}) => {
  4. this.data = data;
  5. this.loading = loading;
  6. });
  7.  
  8. if (!this.loading) {
  9. // using this.data
  10. }
  11. }
  12.  
  13. componentWillReceiveProps(newProps){
  14. if(!newProps.query.loading){
  15. this.setState({data: newProps.query.data})
  16. }
  17. }
Add Comment
Please, Sign In to add comment